Substituing a profile in a jpeg file

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
dargaud
Posts: 31
Joined: 2006-08-06T01:58:58-07:00

Substituing a profile in a jpeg file

Post by dargaud »

Hello all,
I thought I'd asked this before but I can't find trace of it. How do you substitute a profile
in a JPG file without touching the bits ?

If I do:

Code: Select all

convert -verbose -profile $AdobeICC Source.jpg -profile $AdobeICC Dest.jpg
The file gets recompressed

The reason I want to do that is that my files contain AdobeRGB profiles that
are not recognized by some apps. I want to substitute with another similar
profile that _is_ recognised, without changing anything else (exif info,
bits...). Maybe something like mogrify would be better suited but I got the same kind of recompression.

Thanks
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Substituing a profile in a jpeg file

Post by anthony »

IM can NOT do this. IM is a general raster image processor, for modifying images.
It is not a specific JPEG lossless processor. Its functions for profiles are more about using them while modifying the image in some way (resizing, distorting, color modifying, etc etc etc).

There are however lots of programs that can interact with JPG images losslessly. Starting with lowlevel jpegtrans, through to jhead (which restores profiles that jpegtrans junks) and so on. I suggest you look at those.

See //www.imagemagick.org/Usage/formats/#jpg
I also updated this section but it may two a couple of days to appear on the main site.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
dargaud
Posts: 31
Joined: 2006-08-06T01:58:58-07:00

Re: Substituing a profile in a jpeg file

Post by dargaud »

Thank you, at least that's clear.

I didn't know you could manipulate profiles with jhead... I see nothing about that in its doc.

And isn't jpegtrans outdated ? I remember using it for lossless rotations but I can hardly find a working link to the code...
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Substituing a profile in a jpeg file

Post by anthony »

jpegtrans is the primary lossless transformer. It comes with the JPEG libraries, so it is probably on the system. jhead even uses it. But it does not handle profiles well, which is one function jhead does manage in its calls to jpegtrans.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply