LyX ⇒ Scaling of images in output PDF
Scaling of images in output PDF
When using PNG-files in my lyx document, they get scaled (up) in the exported pdf. I'm exporting with pdflatex, and have not enabled scaling as far as I can tell.
I'm currently using Lyx 2.0.0 RC1 on Ubuntu, but I've experienced the same problem with Lyx 1.6.9 on Windows.
SOLVED: I suggest you simply read through the whole thread for a solution if you're having the same issues as me. Many thanks to meho_r and localghost for the help, much appreciated.
I'm currently using Lyx 2.0.0 RC1 on Ubuntu, but I've experienced the same problem with Lyx 1.6.9 on Windows.
SOLVED: I suggest you simply read through the whole thread for a solution if you're having the same issues as me. Many thanks to meho_r and localghost for the help, much appreciated.
Last edited by jdefoe on Tue Apr 12, 2011 10:52 am, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.

Re: Scaling of images in output PDF
This is unusual. Can you create an example .lyx file, put it into a ZIP archive together with a sample PNG image and the PDF output, and attach them to your next post, please?
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Scaling of images in output PDF
You have to take the relation between postscript point and pixel into account (1.333… or 0.75, respectively) [1]. So try to scale the concerned picture(s) to three quarters of the original size while including. In LaTeX this would be done by the graphicx package.jdefoe wrote:When using PNG-files in my lyx document, they get scaled (up) in the exported pdf. […]
Code: Select all
\includegraphics[scale=0.75]{‹filename›}
Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Scaling of images in output PDF
Attached is the example file as requested. I booted up my Windows-laptop to create the file with lyx 1.6.9, because lyx 2.x.x files are incompatible with earlier versions.
Another thing I notice is that it takes up to several minutes to create the PDF-file with pdflatex with the 1.6.9 version on Windows, compared to my current Ubuntu desktop where it only takes a couple of seconds.
Edit: Sorry, I was composing this post so I didn't notice the last answer there. I'll try that right away!
Edit2: Thank you very much for pointing out the relation between postscript point and pixel Thorsten, and for the welcome.
This is exactly my problem indeed. I can't seem to get the scale function to work though, as I get this output:
I assume I'm doing something wrong here?
Edit3: It hits me that when using PNG-files some sort of scaling probably is inevitable. So my next question would be, is there a format more appropriate for figures? I'm thinking the best solution would be some sort of scaleable (vector) format?
Another thing I notice is that it takes up to several minutes to create the PDF-file with pdflatex with the 1.6.9 version on Windows, compared to my current Ubuntu desktop where it only takes a couple of seconds.
Edit: Sorry, I was composing this post so I didn't notice the last answer there. I'll try that right away!
Edit2: Thank you very much for pointing out the relation between postscript point and pixel Thorsten, and for the welcome.
This is exactly my problem indeed. I can't seem to get the scale function to work though, as I get this output:
Code: Select all
Code, edit and compile here:
LaTeX Error: Missing \begin{document}.\includegraphics[scale=0.75]{skisse01.png}You're in trouble here. Try typing <return> to proceed.If that doesn't work, type X <return> to quit.
Edit3: It hits me that when using PNG-files some sort of scaling probably is inevitable. So my next question would be, is there a format more appropriate for figures? I'm thinking the best solution would be some sort of scaleable (vector) format?
- Attachments
-
- example.zip
- The example files as requested.
- (4.32 KiB) Downloaded 215 times
Last edited by jdefoe on Mon Apr 11, 2011 8:05 pm, edited 1 time in total.
Re: Scaling of images in output PDF
To put it simple: the image isn't scaled at all. To see for yourself, open it in an image editor (e.g. GIMP) and take a look at it's size: it is 140.05 x 128 mm, exactly as it appears in the PDF output. However, the resolution is terrible: ~50 dpi which is far below a minimum.
Suggestions:
1. Always prepare the image in an image editor before using it in your document
2. At least 300 dpi resolution is required for images which should be printed
3. Use vector graphics whenever you can instead of bitmap graphics. This image you attached would look much better if you exported it as an SVG or PDF file instead of PNG.
Suggestions:
1. Always prepare the image in an image editor before using it in your document
2. At least 300 dpi resolution is required for images which should be printed
3. Use vector graphics whenever you can instead of bitmap graphics. This image you attached would look much better if you exported it as an SVG or PDF file instead of PNG.
- Attachments
-
- example-1.zip
- An example file. LyX 2.0.0rc2 or greater needed.
- (8.02 KiB) Downloaded 221 times
Re: Scaling of images in output PDF
Well, it becomes more and more evident to me that I have a lot to learn. Clearly my image is far too low resolution for print, but I'm left with one question in this regard. Lyx (or its back end) must be doing some kind of scaling with my low resolution PNG-image, as it should turn out really small in the final PDF-file, instead it turns out really big (see picture attached for example).
I'm really thankful for your suggestions by the way, and I will most certainly stick with those formats where possible. Also thank you for taking the time to supply an example.
I'm really thankful for your suggestions by the way, and I will most certainly stick with those formats where possible. Also thank you for taking the time to supply an example.
- Attachments
-
- How the output PDF-file looks like.
- Screenshot-1.png (18.22 KiB) Viewed 13663 times
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Scaling of images in output PDF
TeX (the back-end) is not interested to do anything with image files but to just include them. The seeming scale is just a result of the relation I mentioned in my last reply. The DPI value influences only the printed output but does not really affect the appearance in the electronic document.jdefoe wrote:[…] Lyx (or its back end) must be doing some kind of scaling with my low resolution PNG-image, as it should turn out really small in the final PDF-file, instead it turns out really big (see picture attached for example). […]
The best way to check that is to include a small screen capture into a document and try to let it appear in the document as it appears on the screen.
But as already mentioned, it can't do any harm to have a plan for including image files into a LaTeX document. Some pre-processing might be necessary to get the desired result.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Scaling of images in output PDF
Ok, well, this has clarified a lot for me. I'll stick with scalable image-formats from now on, or higher resolution PNGs if that's the only alternative.
Seems as if my problem has been solved, so I'll do the necessary changes to the thread. Thanks a lot!
Seems as if my problem has been solved, so I'll do the necessary changes to the thread. Thanks a lot!
Re: Scaling of images in output PDF
I don't understand.
On an image inserted in Lyx, double click, and you should be presented with scaling and clipping options. If they are there and don't work, report it as a bug.
On an image inserted in Lyx, double click, and you should be presented with scaling and clipping options. If they are there and don't work, report it as a bug.