Imagemagick convert

Fixing and making things, what tools to get and what skills to learn, ...
Post Reply
jacob
Site Admin
Posts: 15969
Joined: Fri Jun 28, 2013 8:38 pm
Location: USA, Zone 5b, Koppen Dfa, Elev. 620ft, Walkscore 77
Contact:

Post by jacob »

Anyone really familiar with it?
I need to convert my pdf graphics into gif for the kindle version, but I keep stumbling. Maybe it's something that can be fixed in 5 minutes for those in the know.
Here's the wrong way to do it
convert specialistmoney.pdf -density 300 -resample 300x300 -units pixelsperinch -quality 100 specialistmoney.gif
The gif comes out all jagged.


Jon
Posts: 35
Joined: Fri Jul 23, 2010 1:10 am

Post by Jon »

open pdf
windows key + print screen
open in ms paint
crop
resize
then save as gif


jacob
Site Admin
Posts: 15969
Joined: Fri Jun 28, 2013 8:38 pm
Location: USA, Zone 5b, Koppen Dfa, Elev. 620ft, Walkscore 77
Contact:

Post by jacob »

It's a wee bit more complicated than that :)


photoguy
Posts: 202
Joined: Fri Aug 20, 2010 4:45 pm
Contact:

Post by photoguy »

Are you viewing the GIF at 1:1?
300 dpi is quite a bit higher resolution than most monitor screens. So I'm guessing what is happening is that you are converting the image properly (at 300dpi), but since your computer screen is 72 (or maybe 96dpi) the viewing program is resizing the image for display and not doing a good job of it.
If the kindle screen is say 72 dpi, don't you want to use -resample 72x72 ?


jacob
Site Admin
Posts: 15969
Joined: Fri Jun 28, 2013 8:38 pm
Location: USA, Zone 5b, Koppen Dfa, Elev. 620ft, Walkscore 77
Contact:

Post by jacob »

@photoguy - I think you're on the right track. What I'm currently doing is resampling to 300dpi (which make the pics very large on the screen) and then resizing them afterwards.
What I think was/is the problem is that the images were/are too large to begin with.
This requires some manual calculations.


jacob
Site Admin
Posts: 15969
Joined: Fri Jun 28, 2013 8:38 pm
Location: USA, Zone 5b, Koppen Dfa, Elev. 620ft, Walkscore 77
Contact:

Post by jacob »

Okay, I believe I have a solution. I'll need to manually resize the 32 illustrations.


JohnnyH
Posts: 2005
Joined: Thu Jul 22, 2010 6:00 pm
Location: Rockies

Post by JohnnyH »

Do you have the source files of the images? It would be a very easy batch if you did.


jacob
Site Admin
Posts: 15969
Joined: Fri Jun 28, 2013 8:38 pm
Location: USA, Zone 5b, Koppen Dfa, Elev. 620ft, Walkscore 77
Contact:

Post by jacob »

I'm running a batch script. Unfortunately, I have not found an easy way to preserve the aspect ratio. Anyhow, it's done now. Now I have to go into the html and use width and height to ensure that some of the pics don't expand to the full screen.


photoguy
Posts: 202
Joined: Fri Aug 20, 2010 4:45 pm
Contact:

Post by photoguy »

In the past, I've called convert from a perl script. Perl has an image module that lets you get the image dimensions and then you can just feed the right numbers to convert.


Britz
Posts: 36
Joined: Fri Jul 23, 2010 4:36 am
Contact:

Post by Britz »

[This reply is probably too late to be of use but...]

PDF Tools 7.0 is fantastic freeware that does all sorts of stuff, sometimes better than Adobe's own ware. One of the tools is the conversion of a pdf to pictures, either png, jpg, bmp, or tiff, at user-determined resolutions between 6-600 dpi.


blah
Posts: 29
Joined: Mon Dec 20, 2010 6:58 am
Contact:

Post by blah »

Imagemagick rocks! Have you checked out conjure? It lets you run scripts written in MSL (Magick Scripting Language) which is basically, an XML type markup language.

Sorry, I didn't see this post sooner. I am glad you found a solution.


MossySF
Posts: 44
Joined: Sun Nov 14, 2010 5:32 pm
Contact:

Post by MossySF »

I haven't used ImageMagick directly but I have used it via the PerlMagick interface -- and my experience when resizing is you need to set to 24-bit format first. That means PNG or JPG. Afterwards, you can convert again to GIF. But if you first initialize the work space as GIF, the resizing looks poor.
Via the perl interface, you can read the original image size and then calculate out the new size to preserve the aspect ratio.


Post Reply