Bug 45168 - Add option to allow cropped (reduce size) images in PDF Export
Summary: Add option to allow cropped (reduce size) images in PDF Export
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard: ToBeReviewed
Keywords: filter:pdf
Depends on:
Blocks: PDF-Export Image-Crop 109143
  Show dependency treegraph
 
Reported: 2012-01-24 04:57 UTC by Fernand
Modified: 2019-01-14 11:00 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fernand 2012-01-24 04:57:59 UTC
The size of PDF files produced by LO-PDF export can be the double of this produced using postscript rendering.
By postscript rendering images use only the CROPED size off the images,  the LO-
Cairo-rendering uses the FULL image to store in the PDF file.
I do not know if Cairo lets the choice between Cropped and Full size
rendering ?
For editing PDF , full size is handy, but a option with the choise between the two would be super handy.
Reducing Size for PDF (on the web) is still important !
Comment 1 Thorsten Behrens (CIB) 2012-02-22 01:16:27 UTC
That's a nice localized change that would be suitable as an EasyHack: one would need to review all methods rendering bitmaps in vcl/source/gdi/pdfwriter_impl.cxx (e.g. PDFWriterImpl::drawJPGBitmap() etc), inspect the current graphic state (see PDFWriterImpl::updateGraphicsState() for what's going on there regarding clip), and then prune the bitmaps written to pdf down to what's not clipped away.
Comment 2 Fernand 2012-02-22 02:13:04 UTC
The chooise between cropped and non-cropped would be ideal
Comment 3 Samuel Mehrbrodt (CIB) 2013-04-21 15:22:42 UTC
This enhancement would be really useful. I support it via Freedomsponsors: http://www.freedomsponsors.org/core/issue/246/add-option-to-crop-images-in-pdf-export
Comment 4 Arthur Maciejewicz 2013-06-24 04:38:37 UTC
I am beginning work on this issue.
Comment 5 Björn Michaelsen 2013-10-04 18:47:13 UTC
adding LibreOffice developer list as CC to unresolved EasyHacks for better visibility.

see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details
Comment 6 Jorendc 2014-01-21 10:22:11 UTC
(In reply to comment #4)
> I am beginning work on this issue.

@Arthur: any progression on this one? Still working on it?
If not, please mind to reset the 'assigned to' field, so others can have a look.

Kind regards,
Joren
Comment 7 Fernand 2014-06-22 07:11:58 UTC
>> Dag Cor welkom hier 
In the mean time i have writen this option in Basic who is a bit slow because i replace al cropped images by new images (with the cropped size an the propper resolution). For better quality i can use ImageMagic or when quality is less important, the LO graphicfilter who produce sometimes less quality conversions.
If someone is interested i can post the code here
Comment 8 Cor Nouws 2014-06-22 21:03:38 UTC
(In reply to comment #7)
> >> Dag Cor welkom hier 

Didn't we meet before in BugZilla :) There are numerous issues that I commented or reported ;)

> If someone is interested i can post the code here

Thanks for the kind offering Fernand - I'll remember this.
Comment 9 Daniel Miranda 2014-10-14 04:09:34 UTC
I plan to work on this, but I'd like some clarifications first. Is cropping the only desired feature, or is automatic resizing/resampling of non-cropped images wanted well? I can grasp the PDFWrite without much difficulty, but I don't know how would be the best way to provide UI toggles, or where their corresponding code should be. Any assistance would be appreciated.
Comment 10 Fernand 2014-10-14 05:54:45 UTC
Daniel,

Thanks for the interest  to improve LO to make better (more professional) PDF.
IN LO we ca do everyting needend to produce high quality documents, books, magazines etc. The link to Professional printers is still PDF.
Here we are talking about the storing of images in the resulting PDF.
2 options:
Full Image who permit to re-edit this image in the PDF.
Cropped Size off the Image who delivers smaller PDF

Resampling is a separeted thing and can now allready been done when using the API and macro to produce the PDF (filter options).
But The Resampling is not present in the current GUI and can been ussefull as well.

I Suppose there can been more done to make smaller, leaner PDF also

Storing, a PDFdocument as a Image (not a OLE object) in LO documents would also been a greath improvement !

Greetz

Fernand
Comment 11 Samuel Mehrbrodt (CIB) 2014-10-14 11:46:53 UTC
@Daniel: You could start by adding support for cropping.
I would turn it on by default and add an option to toggle it off under the "Image" options in the pdf export dialog.

Please ask if you need code pointers - you can also join IRC and ask there!
Comment 12 Robinson Tryon (qubit) 2015-12-14 05:03:39 UTC Comment hidden (obsolete)
Comment 13 Cor Nouws 2016-02-03 13:29:20 UTC
So for renewing my understanding of this:
 - it is when images are croped in the document, that then at PDF-export only that part of the image ?
 - so not the same as setting the resolution in the dialog PDF Options..
Comment 14 Robinson Tryon (qubit) 2016-02-18 14:52:23 UTC Comment hidden (obsolete)
Comment 15 Dipankar Niranjan 2016-02-20 05:08:22 UTC
(In reply to Samuel Mehrbrodt (CIB) from comment #11) 
> Please ask if you need code pointers - you can also join IRC and ask there!

Hi,
Any code pointers on where to look and how to get the changes from updateGraphicsState() to reflect in the storing of the image..?
Like which classes/variables would I have to look at to get the size(of the image) data stored by updateGraphicsState()?
Where do I need to look to reduce the size of the image on cropping..?
Also code pointers to where I should insert UI toggles for this would be helpful too.

I've asked on the IRC and was told to ask here..
Comment 16 jani 2016-02-20 08:07:31 UTC
sorry, this is not really a easyhack (yet), with the missing code pointer, I suggest you look for another.

Fernand, please add a code pointer
Comment 17 Thorsten Behrens (CIB) 2016-02-20 08:23:14 UTC
(In reply to jan iversen from comment #16)
> sorry, this is not really a easyhack (yet), with the missing code pointer, I
> suggest you look for another.
> 
What's missing from Comment 1? This is labelled 'difficulty interesting' for a reason. ;)
Comment 18 Dipankar Niranjan 2016-02-20 09:17:57 UTC
> What's missing from Comment 1? This is labelled 'difficulty interesting' for
> a reason. ;)
Anything more to go on will be really helpful..
Comment 19 jani 2016-02-21 10:27:14 UTC
Thorsten, you are completely right, I oversaw your earlier comment.
Comment 20 Fernand 2016-02-22 08:43:07 UTC
OK:
Sinds i posted the proposal the PDF export has been upgraded.
We can already change the images resolution on export.

But: we still need a option to choose if the images in the document sould been exported at full size or only the visible (croped aera).

Thanks for the interest
Comment 21 jani 2016-04-22 07:04:37 UTC Comment hidden (obsolete)
Comment 22 Stanislav Horacek 2016-04-22 18:06:24 UTC
This is a clear enhancement request, so I think NEEDINFO is not appropriate here -> setting back to NEW.
Comment 23 jani 2016-04-22 20:08:21 UTC
Code pointer are mandatory for easyhacks, removing easyhack since NEW ia preferred to suplying a code pointer.

NEEDINFO is used when a bug misses info, independent which type.
Comment 24 V Stuart Foote 2017-07-25 12:54:18 UTC
*** Bug 109143 has been marked as a duplicate of this bug. ***