Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
BrowserUk has already said it, but for a computer, the specification "300dpi" by itself is useless, because it only tells us what density you want to print at. For it to be useful for the computer, you need to say something like "3000x2000 pixels printed at 300dpi" (which will result in a print of roughly 25.4x16.9cm), or "10x20cm at 300dpi", which is an image of 1181x2362 pixels. That same 1181x2362 pixel image can also be printed at 600dpi, in which case it will be 5x10cm, or at 150dpi, in which case it will be 20x40cm.

Anyway, maybe what you are asking about is the DPI information stored as part of the image headers. I have had success in changing it using Image::ExifTool, at least this changes the image's DPI reported by The Gimp.

use Image::ExifTool; my $DPI = 300; my $exif = Image::ExifTool->new; $exif->SetNewValue("XResolution",$DPI); $exif->SetNewValue("YResolution",$DPI); $exif->SetNewValue("ResolutionUnit","inches"); $exif->WriteInfo($FILE) or warn "Failed to update EXIF in $FILE";
Or on the command line:
exiftool -XResolution=300 -YResolution=300 -ResolutionUnit=inches file +.jpg
For the computer, this DPI information is relatively useless, because the computer only cares about how many pixels the image has. You can change this header all you want and the pixel data will not change, the image will not be resized to a different number of pixels. The DPI information will only become useful to a printer. But most printers that I know will always let you specify the DPI you want to print with as a separate setting. The only scenario I can imagine where the above will be useful to you is if you have some program or printer that does care about the DPI information stored in the image header.

In reply to Re: GD @ 300dpi output by Anonymous Monk
in thread GD @ 300dpi output by themcp

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-06-24 10:04 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.