Hi all,
I have 2 pictures with the same size (712x484). I used \includegraphics(width=6.5cm){filename) to add them into my paper but the pictures appearing in the pdf document have different heights.
In my opinion, because the pictures have the same size and I set the same widths, their heights should be the same. Has anybody met this problem? Please give me a solution for this. Many thanks in advance.
Hai
General ⇒ include pictures with wrong scale
NEW: TikZ book now 40% off at Amazon.com for a short time.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
include pictures with wrong scale
If you could provide these graphics files (as attachment), we could examine them and test that ourself. Without that it is very difficult to get a clue. Perhaps an additional piece of code in the sense of a minimal working example (MWE) could also be helpful.
Best regards
Thorsten¹
Best regards
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
Re: include pictures with wrong scale
Thanks Thorsten for your reply. Here are the pics and the MWE and the pdf result as well.
- Attachments
-
- D164-2K.PNG (196.94 KiB) Viewed 5076 times
-
- D152-2K.png (201.11 KiB) Viewed 5077 times
-
- test.tex
- (300 Bytes) Downloaded 196 times
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
include pictures with wrong scale
At first I was really at a loss, because I never faced such a problem. But then I had the idea of examining the files with GIMP. What I found out is that the two images have different resolutions in x- and y-direction. Here are the facts.
- d152-2k.png
- x-resolution: 72.009 px/in
- y-resolution: 72.009 px/in
- d164-2k.png
- x-resolution: 74.981 px/in
- y-resolution: 67.996 px/in
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
include pictures with wrong scale
An alternative to editing the (wrongly set) aspect ratio within the file using GIMP, you may explicitly set the height as well in the includegraphics call,
where I calculated 4.08cm by hand (assuming 1:1 aspect ratio for the pixels in the original picture).
Code: Select all
\includegraphics[width=6cm,height=4.08cm]{d152-2k}
Re: include pictures with wrong scale
Thank you very much.
That's the perfect answer. I knew that I was wrong, not Latex but I did not know what it was.
Hai
That's the perfect answer. I knew that I was wrong, not Latex but I did not know what it was.
Hai