Background turns from white to gray

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
peter.michner
Posts: 2
Joined: 2014-11-07T18:24:25-07:00
Authentication code: 6789

Background turns from white to gray

Post by peter.michner »

Hello.
I made a gif file from a pdf file using image magick which I made from a tex file using xelatex and I confirmed using GIMP that all of my 120 frames do have a white background and none of the frames have any alpha channels. I made the gif with the command

Code: Select all

convert -delay 4 -loop 1 -density 200 -alpha remove coordinates.pdf coordinates.gif
and then I converted the gif to an mpg with the command

Code: Select all

convert coordinates.gif coordinates.mpg
But when I run the mpg, the background is no longer a clean white but a dirty gray. Does anyone know what I can do? Thanks.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Background turns from white to gray

Post by fmw42 »

What version of IM and what platform?

try

Code: Select all

convert -delay 4 -density 200 coordinates.pdf -alpha off -loop 1 coordinates.gif
Does that make any difference?

What is the delegate that IM is using to convert to mpeg? Typically it is ffmpeg. Does

convert -list delegates

list mpeg?

If it shows and If your version of IM is old, then try upgrading. If it is reasonably current, then check the version of ffmpeg using

ffmpeg --version

Mine is
ffmpeg version 2.2.2 Copyright (c) 2000-2014 the FFmpeg developers

Perhaps that needs upgrading.

If all else fails, you can upload your pdf to dropbox.com and post the URL here and someone will likely be able to verify it and provide a good command.
peter.michner
Posts: 2
Joined: 2014-11-07T18:24:25-07:00
Authentication code: 6789

Re: Background turns from white to gray

Post by peter.michner »

I just downloaded ImageMagick a few days ago, my version is:

Code: Select all

Version: ImageMagick 6.8.9-8 Q16 x64 2014-08-26 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo freetype jbig jng jp2 jpeg lcms lqr pangocairo png ps rsv
g tiff webp xml zlib
Yes, when I type convert -list delegate, for mpeg, I see

Code: Select all

mpeg:decode =>          "ffmpeg.exe" -v -1 -i "%i" -vframes %S -vcodec pam -an -
f rawvideo -y "%u.pam"
But when I type ffmpeg -version I see

Code: Select all

ffmpeg version N-50911-g9efcfbe
built on Mar 13 2013 21:26:48 with gcc 4.7.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avis
ynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable
-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm
 --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libope
ncore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libs
chroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtw
olame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-
libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil      52. 19.100 / 52. 19.100
libavcodec     55.  0.100 / 55.  0.100
libavformat    55.  0.100 / 55.  0.100
libavdevice    54.  4.100 / 54.  4.100
libavfilter     3. 45.103 /  3. 45.103
libswscale      2.  2.100 /  2.  2.100
libswresample   0. 17.102 /  0. 17.102
libpostproc    52.  2.100 / 52.  2.100
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Background turns from white to gray

Post by snibgo »

I wouldn't go via GIF. One problem is that GIF compression works one way (by reducing the number of colours) where MPG compression works a different way (it works like JPEG, so it really doesn't like areas of flat colour, ie GIF files).

Ffmpeg has a quality setting, which I don't think is accessible from IM. In that quality setting, lower number are higher quality. "2" is high quality, "20" is low quality. So you could extract the images with IM to a lossless format such as PNG, then run ffmpeg to combine those into a MPG.
snibgo's IM pages: im.snibgo.com
Post Reply