On 08/01/2011 06:30 AM paul womack wrote: > ken wrote: >> Why is it, when I insert a short comment in a jpeg, that the size of the >> resulting jpeg file increases so much? E.g., >> >> $ stat --format="%n %s" test.jpg ; convert -comment "This is a comment >> inserted by me." test.jpg test1.jpg; stat --format="%n %s" test*.jpg >> test.jpg 3460012 >> test1.jpg 3471325 >> test.jpg 3460012 >> >> The comment inserted is a mere 34 characters. The increase in the file >> size, however, is 11313 bytes. >> >> Moreover, if I then change the comment to some other text which is >> exactly the same length, the size of the file increases quite radically >> again. Why does this happen? >> > > Probably because you're (effectively) rewriting the JPEG stream with a > different > quality number, even though (I suspect) this is not your intent. > > You might want to look into Exiftool; > > http://www.sno.phy.queensu.ca/~phil/exiftool/ > > BugBear
Paul, Thanks much for your reply... and for understanding my question... and for the link to exiftool. It sounds like just what I'm needing. I'll give it a try. What you say about the quality number sounds plausible. Though I've never looked at any of the IM code, I suspected something like that. If a change in quality is what the "convert" code is doing, I feel it's unfortunate that it is because, in this case at least, since the image is directly from the camera, any change in the image whatsoever is by definition a *lowering* of the quality. Moreover then, why would an image of lower quality result in a larger file? That's a rhetorical question of course. The answer is likely too demanding to explain in an email and more than I would understand or care to. Perhaps a better question would be, why should IM mess with the "quality" at all unless the user specifically asks for it? Having worked with developers before (was one myself years ago), I understand that this ostensibly simple question can inflate to a major issue and evoke more dialogue than most people's Mondays can accommodate. I.e., I'm not suggesting a subthread on it. :) Paul, thanks again for the tip on exiftool. Best regards, ken -- "When a society comes together and makes decisions in harmony, when it respects its most noble traditions, cares for its most vulnerable members, treats its forests and lands with respect, then it will prosper and not decline." --Buddha, Mahaparinirvana Sutra _______________________________________________ Magick-developers mailing list Magick-developers@imagemagick.org http://studio.imagemagick.org/mailman/listinfo/magick-developers