convert the same image

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
chanoy

convert the same image

Post by chanoy »

Hi,

I'm just curious on how convert will work if I convert an image to a different location with the same extension. Will the algorithm knows that no conversion is needed, and thus just copy the file to the other location?

For example,
"convert af1.pgm ./temp/af1.pgm"

A simple test tells me that it will create the af1.pgm in temp directory, but I'm just wondering if the algorithm just do a file copy or actually "converts" it (which takes more time, more calculations, and same result)?

Thanks,
onyee
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: convert the same image

Post by magick »

If you convert an image onto itself, the convert program will read the image file and then write it back out to the same image file location.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: convert the same image

Post by anthony »

Of course some image formats will thus change. JPEG will have some image compression degrading, PNG might be saved in a different style (basied on content), and some formats include date information.

I suggest you actually copy when you mean copy.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply