Bug 52979 - [pdfimages] Feature request: additional column for '-list' indicating disk space consumption by embedded image
Summary: [pdfimages] Feature request: additional column for '-list' indicating disk sp...
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: utils (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-30 22:03 UTC by pipitas
Modified: 2014-07-05 11:10 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
print extra image info (8.71 KB, patch)
2013-08-17 11:30 UTC, Adrian Johnson
Details | Splinter Review
fix bug in pdfimages -list output (990 bytes, patch)
2013-08-17 11:32 UTC, Adrian Johnson
Details | Splinter Review
print extra image info (5.88 KB, patch)
2013-08-21 11:50 UTC, Adrian Johnson
Details | Splinter Review
print extra image info (5.87 KB, patch)
2013-08-21 12:55 UTC, Adrian Johnson
Details | Splinter Review

Description pipitas 2012-07-30 22:03:41 UTC
I'm extremely pleased with the new feature given by '-list' for 'pdfimages'. Thanks a lot for this (whoever implemented this, I'll find out and write a personal thank-you-email :-)

May I ask for another feature that would fit well into the '-list' output?

* Give additional info about the size of each image (in bytes or kBytes) as consumed inside the PDF!

This info could frequently be very useful to know, not only for debugging purposes.
Comment 1 Adrian Johnson 2013-08-17 11:30:49 UTC
Created attachment 84170 [details] [review]
print extra image info

I recently had the need to get additional image info (including the embedded size) from pdfimages.

The attached patch adds a '-list-extra' option to pdfimages to list the image info with the following extra columns:

- horizontal and vertical image pixels per inch (some pdfs have different values for these)
- embedded image size
- compression ratio

I'm not sure whether it is better to use a separate option for the extra info (as I did with this patch) or just add the columns to the existing -list output.
Comment 2 Adrian Johnson 2013-08-17 11:32:13 UTC
Created attachment 84171 [details] [review]
fix bug in pdfimages -list output

Fix for a bug I found in the pdfimages -list output while testing the previous patch.
Comment 3 Albert Astals Cid 2013-08-17 14:28:53 UTC
Looks ok to me, I haven't checked the code to be totally correct, but if it breaks, it will only break the new feature, and that's reason enough to commit it to master and let it mature in there.

So for me you can commit it, maybe wait a few days in case someone else has some comments.
Comment 4 Adrian Johnson 2013-08-20 14:00:55 UTC
Any opinion on whether to use the '-list-extra' option or add the columns to the existing output? I'm not sure what our policy is on changing the output of the utils.
Comment 5 Albert Astals Cid 2013-08-20 18:17:59 UTC
i think the policy is "try to break stuff as little as possible"

I understand that in your case, logically it makes sense to add stuff before the objectID, but maybe you could add it after? that way it's harder we break stuff that parses the output?

otoh if you want the list-extra i'm fine with that too

What's your opinion?
Comment 6 Adrian Johnson 2013-08-21 11:50:25 UTC
Created attachment 84386 [details] [review]
print extra image info

Adding '-list-extra' seems kind of awkward. Adding the columns after the object ID is probably better. It preserves compatibility and allows us to append another column to the end if we find something else is needed.

I've changed the patch to implement this as well to fix:
- the ppi of rotated images
- size of inline images (ie not supported)
- print ppi if < 1 (one of the PDFs had a 1x1 image that was stretched out to a much larger size).
Comment 7 Adrian Johnson 2013-08-21 12:55:14 UTC
Created attachment 84388 [details] [review]
print extra image info

fix bug
Comment 8 Albert Astals Cid 2013-08-25 16:44:31 UTC
Looks sane, you probably want to remove the change in pdfimages.cc though ;-)

If you've run this all over the reg test files, feel free to commit. If not tell me and i'll do.
Comment 9 Adrian Johnson 2013-08-25 21:09:42 UTC
I ran pdfimages -list over the reg test files to see if there any any crashes.
Comment 10 Albert Astals Cid 2013-08-25 21:12:07 UTC
Go for it then :-)
Comment 11 Adrian Johnson 2013-08-25 22:13:41 UTC
Pushed
Comment 12 kurt.pfeifle 2014-07-05 11:10:34 UTC
Thank you very much for this new feature in pdfimages!

I use it a *lot*, it's very useful to me.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.