# Is it OK to scale image by changing its resolution?

Assume I have an image fruit240.jpg of 800 pixels by 600 pixels at resolution of 240 dpi.

Normally I can scale it by half using the following way.

\documentclass{article}

\usepackage{xcolor,graphicx}

\parindent=0pt
\fboxsep=0pt
\fboxrule=5pt

\begin{document}
{\color{red}\fbox{\includegraphics[scale=0.5]{fruit240}}}
\end{document}


Doubling resolution by invoking ImageMagick's convert as follows apparently makes the same effect as scaling by half.

convert fruit240.jpg -density 480 fruit480.jpg

\documentclass{article}

\usepackage{xcolor,graphicx}

\parindent=0pt
\fboxsep=0pt
\fboxrule=5pt

\begin{document}
{\color{red}\fbox{\includegraphics{fruit480}}}
\end{document}


Is it OK to scale image by changing its resolution?

-

## 1 Answer

Yes, changing the resolution using the -density operator in ImageMagick (or through the Information window in IrfanView) is a lossless operation. From the ImageMagick documentation:

The -density option sets an attribute and does not alter the underlying raster image.

-
+1 but up to now, I don't understand why the resolution is defined like that. In my mental model, changing resolution is related to resampling the image. :-) –  xport Aug 4 '11 at 2:09
The resolution is basically a factor for converting from pixels to physical lengths (like centimetres). If your image is 1000 px wide, and has a resolution of 250 dpi (dots per inch, the same as pixels per inch), then the physical width of the image is going to be 1000 px / 250 dpi = 4 in. If you change the resolution to 500 dpi, the image is still 1000 px wide, but it will now have a physical width of 1000 px / 500 dpi = 2 in. No information is lost in this process. –  Jake Aug 4 '11 at 2:14
@xport: “In my mental model, changing resolution is related to resampling the image.” That is because you are thinking of the case where you change the resolution while fixing the physical size (such as 4 in × 3 in). When you tell ImageMagick to change the resolution, it does so while fixing the size in pixels (such as 1000 px × 750 px). –  Tsuyoshi Ito Aug 4 '11 at 2:49
What is the geometrical form of a single pixel defined in an image file? Is it circular or rectangular? –  xport Aug 4 '11 at 19:16
@xport: It's rectangular, and if the horizontal and vertical resolutions are equal, which is usually the case, it's square. –  Jake Aug 4 '11 at 23:17