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
: 131535 (view as bug list)
Depends on:
Blocks: PDF-Export Image-Crop 109143
  Show dependency treegraph
 
Reported: 2012-01-24 04:57 UTC by Fernand
Modified: 2023-04-21 16:39 UTC (History)
9 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 (allotropia) 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 (allotropia) 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 Comment hidden (obsolete)
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 Comment hidden (obsolete)
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 Comment hidden (obsolete)
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 (allotropia) 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 Comment hidden (obsolete)
Comment 17 Thorsten Behrens (allotropia) 2016-02-20 08:23:14 UTC Comment hidden (obsolete)
Comment 18 Dipankar Niranjan 2016-02-20 09:17:57 UTC Comment hidden (obsolete)
Comment 19 jani 2016-02-21 10:27:14 UTC Comment hidden (obsolete)
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 Comment hidden (obsolete)
Comment 23 jani 2016-04-22 20:08:21 UTC Comment hidden (obsolete)
Comment 24 V Stuart Foote 2017-07-25 12:54:18 UTC
*** Bug 109143 has been marked as a duplicate of this bug. ***
Comment 25 Timur 2020-09-04 06:50:59 UTC
*** Bug 131535 has been marked as a duplicate of this bug. ***