Thumbnail creation size is not decreasing very much

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
babbarkrishan
Posts: 2
Joined: 2014-04-11T07:38:09-07:00
Authentication code: 6789

Thumbnail creation size is not decreasing very much

Post by babbarkrishan »

Hi All,
We are using IM4Java library for creating thumbnails. Our code snippet is given below.

Code: Select all

IMOperation op = new IMOperation();
op.addImage(sourceFileName);
op.thumbnail(Integer.parseInt(dimension.getWidth()));
op.addImage(destinationFileName);
try {
cmd.run(op);
} catch (Exception e) {
log.debug(e.getMessage());
}
It is working fine and creating thumbnails as expected.
Now in one scenario my thumbnail size (not dimension) is not reduced very much.
My Original image is JPG image with dimension 1306x979 and size 3.64 MB.
I created its thumbnail in dimension 200x150 but its size is 2.65 MB.
On the other hand, when we created same dimension thumbnail using Photoshop its size was just 11 KB.

Where as for another JPG image of size 3.72 MB, its creating thumbnail of size 553 KB.

I think the size of every thumbnail should be below 20 KB as per targeted dimension i.e. 200x150.

Please suggest which option of ImageMagic should we use?

Regards,
Krishan
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Thumbnail creation size is not decreasing very much

Post by glennrp »

You've almost certainly got some large metadata in your file. With the commandline interface you'd use the "-strip" option.
I don't know what is the equivalent in the API you are using, but I'm sure there is an equivalent. You can use the
command "identify -verbose file.jpg" to find out what is the extra content.
babbarkrishan
Posts: 2
Joined: 2014-04-11T07:38:09-07:00
Authentication code: 6789

Re: Thumbnail creation size is not decreasing very much

Post by babbarkrishan »

Thanks Buddy,
I added "-strip" argument as given below before calling thumbnail();
op.addRawArgs("-strip");

It worked.

Thanks again.

Krishan
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Thumbnail creation size is not decreasing very much

Post by Bonzo »

That's strange as Imagemagick -thumbnail strips the data automatically where as -resize doesn't. Perhaps the API you are using is using -resize but calling it thumbnail?
Post Reply