* Images in MultiMarkdown -> context -> PDF
@ 2012-11-21 4:42 Guy Stalnaker
2012-11-21 10:07 ` Martin Schröder
0 siblings, 1 reply; 11+ messages in thread
From: Guy Stalnaker @ 2012-11-21 4:42 UTC (permalink / raw)
To: ntg-context
Hello,
Thanks to Aditya I have discovered ConTeXt which, thus far, seems to
give me much more control over the images than LaTex does. Yay! Before
we get the reason for this post, I should note that my workflow is
MultiMarkdown file, pandoc output of standalone context file, then
context on that pandoc output. I have edited the context file to include
a /defineexternalfigure directive to put a frame around all images. The
images I have are all screenshots of application usage steps. The
crucial output is html that goes into our online Knowledge base.
Secondary output is PDF that will be used for our classroom training.
The screen shots are mostly jpg with a scattering of png, and are all
different sizes. The pandoc html output looks very much as we want it as
we can use a css file to customize padding, etc.
I get a very good pdf document, but there is one bewildering issue --
the images in the ConTeXt output pdf document are scaled very small. All
of them, that is, but two which are more correctly sized in the pdf
document. Almost all of them are jpg images created on a MacOS VM using
an application called Skitch. I have looked the images over and besides
some differing exif data all of them have the expected xy dimension
attributes and I can see no difference between the two that are 'right'
in the pdf document and the rest that are too small. I've tried playing
with scale=1000 and factor=<max,fit,broad> in the /defineexternalfigure
directive and none help; scale=1000 changes nothing at all for the small
images and scale values above 1000, while modifying the smaller images
also make the correctly sized images too large. The factor values make
all images scale to fit the textwidth without exception (that is, I can
see no difference whatever in the three options), making smaller images
far to large and pixelated. I took one image and used GIMP to modify its
DPI to 300 thinking perhaps that might be a factor, but the 72dpi and
300dpi images look identically sized in the PDF document.
The texexex output only says this about the images:
<quote>
<./images/group54/26378/CMSLogin_300dpi.jpg>
figures : dimensions of images/group54/26378/CMSLogin_300dpi.jpg
loaded
from figurefile itself
...
<./images/group54/26378/CMSSelectProjectDropDown.jpg>
figures : dimensions of
images/group54/26378/CMSSelectProjectDropDown.j
pg loaded from figurefile itself
</quote>
That output is for both a 300dpi and a 72dpi image. Though is looks like
dimensions are being read, both are too small in the pdf output. I
quoted texexec because it showed output related to the images. Using
'context <fname>' does not produce a similar console output, but the pdf
doc created is the same with the same image size issues.
Also of note is that pdflatex output on a pandoc->latex file does almost
exactly the opposite of what context does--all images are scaled to fit
text width by default (like using factor=max in context). But that is
just as unwanted as having the images too small. The html output when
viewed in a browser shows the same images as expected. None of these
images are the same size and using any width=X value cannot work. Some
screen shots may be 1024 pixels wide while others only 150 pixels wide
(a shot of a button or tab, for example).
I looked through 1.5 years of posts to the comp.tex.context news group
looking for anything might be similar, but no luck. I have put several
of the files involved on a publicly accessible web server. There are two
screen shots of the pdf output showing incorrect image sizing and
correct image sizing and the actual image files themselves. There is the
markdown, context, html, and pdf documents.
https://mywebspace.wisc.edu/jstalnak/web/context/
I know that is a lot. I appreciate any help anyone can provide.
Best regards,
GuyS
--
"There is only love, and then oblivion. Love is all we have
to set against hatred." (paraphrased) Ian McEwan
Guy Stalnaker, I^2@DOIT, 1210 West Dayton Street, Room 3209 CSS, Madison
WI 53719-1220, jstalnak@wisc.edu, work 608.263.8035, cell 608.235.4718,
fax 608.265.6681, page page-guy@watchdog.doit.wisc.edu
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Images in MultiMarkdown -> context -> PDF
2012-11-21 4:42 Images in MultiMarkdown -> context -> PDF Guy Stalnaker
@ 2012-11-21 10:07 ` Martin Schröder
2012-11-21 13:21 ` Guy Stalnaker
0 siblings, 1 reply; 11+ messages in thread
From: Martin Schröder @ 2012-11-21 10:07 UTC (permalink / raw)
To: mailing list for ConTeXt users
2012/11/21 Guy Stalnaker <jstalnak@wisc.edu>:
> I get a very good pdf document, but there is one bewildering issue -- the
> images in the ConTeXt output pdf document are scaled very small. All of
Sounds like the TeX engine gets the wrong idea about the dpi of the images.
Are you using MkII or MkIV?
Best
Martin
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Images in MultiMarkdown -> context -> PDF
2012-11-21 10:07 ` Martin Schröder
@ 2012-11-21 13:21 ` Guy Stalnaker
2012-11-21 14:35 ` Sietse Brouwer
0 siblings, 1 reply; 11+ messages in thread
From: Guy Stalnaker @ 2012-11-21 13:21 UTC (permalink / raw)
To: mailing list for ConTeXt users
I get the same results using texexec and context which means, if I understand rightly, I have used both MkII and MkIV. Interestingly I get similar results using oft as the pandit output. When I open the doc in LibreOffice the images are all scaled too small. Yet I can right-click each and select an Original Size toggle and they shift to their expected size. But note that I attempted to test the dpi theory by selecting an image and using GIMP to set its dpi to 300 yet that resulted in no visible change.
Guy Stalnaker
jstalnak@wisc.edu
jimmyg521@gmail.com
On Nov 21, 2012, at 4:07 AM, Martin Schröder <martin@oneiros.de> wrote:
> 2012/11/21 Guy Stalnaker <jstalnak@wisc.edu>:
>> I get a very good pdf document, but there is one bewildering issue -- the
>> images in the ConTeXt output pdf document are scaled very small. All of
>
> Sounds like the TeX engine gets the wrong idea about the dpi of the images.
> Are you using MkII or MkIV?
>
> Best
> Martin
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive : http://foundry.supelec.fr/projects/contextrev/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Images in MultiMarkdown -> context -> PDF
2012-11-21 13:21 ` Guy Stalnaker
@ 2012-11-21 14:35 ` Sietse Brouwer
2012-11-21 14:55 ` Guy Stalnaker
0 siblings, 1 reply; 11+ messages in thread
From: Sietse Brouwer @ 2012-11-21 14:35 UTC (permalink / raw)
To: mailing list for ConTeXt users
Guy Stalnaker <jstalnak@wisc.edu> wrote:
> I get the same results using texexec and context which means, if I understand rightly, I have used both MkII and MkIV.
Yes, this is correct.
> Interestingly I get similar results using oft as the pandit output.
That does suggest it might be something in the image metadata, too. Is
the image file something you can share? If so, perhaps you could share
it on the list as an attachment (this mailing list allows
attachments), so we could have a go at getting it to work ourselves.
Cheers,
Sietse
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Images in MultiMarkdown -> context -> PDF
2012-11-21 14:35 ` Sietse Brouwer
@ 2012-11-21 14:55 ` Guy Stalnaker
2012-11-21 17:44 ` Peter Rolf
[not found] ` <CAF=dkzwfNWgMQpGe3HXeuAZxpCjmzvJTHxxb-2pK6zKJ3+uBPw@mail.gmail.com>
0 siblings, 2 replies; 11+ messages in thread
From: Guy Stalnaker @ 2012-11-21 14:55 UTC (permalink / raw)
To: mailing list for ConTeXt users
Thanks - see my first post for a link to a web folder where you can find the .tex file, the .pdf context produces, two screenshots of the differing image treatment and two of the image files shown in the screenshots.
Guy Stalnaker
jstalnak@wisc.edu
jimmyg521@gmail.com
On Nov 21, 2012, at 8:35 AM, Sietse Brouwer <sbbrouwer@gmail.com> wrote:
> Guy Stalnaker <jstalnak@wisc.edu> wrote:
>> I get the same results using texexec and context which means, if I understand rightly, I have used both MkII and MkIV.
>
> Yes, this is correct.
>
>> Interestingly I get similar results using oft as the pandit output.
>
> That does suggest it might be something in the image metadata, too. Is
> the image file something you can share? If so, perhaps you could share
> it on the list as an attachment (this mailing list allows
> attachments), so we could have a go at getting it to work ourselves.
>
> Cheers,
> Sietse
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive : http://foundry.supelec.fr/projects/contextrev/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Images in MultiMarkdown -> context -> PDF
2012-11-21 14:55 ` Guy Stalnaker
@ 2012-11-21 17:44 ` Peter Rolf
[not found] ` <CAF=dkzwfNWgMQpGe3HXeuAZxpCjmzvJTHxxb-2pK6zKJ3+uBPw@mail.gmail.com>
1 sibling, 0 replies; 11+ messages in thread
From: Peter Rolf @ 2012-11-21 17:44 UTC (permalink / raw)
To: ntg-context
I suggest that you use 'identify' from ImageMagick to check your graphics.
identify -verbose foo.jpg
One graphic has a defined resolution (72ppi) and one has none.
I also use ImageMagick to automatically add the resolution info to the
graphics. No problems with graphic sizes since then. Here is the
simplyfied content of a batch file that I normally use...
for %%i in (*.png) do convert -units PixelsPerInch -set density 96 "%%i"
The important thing is, that you use PNG as graphic format, when you
make your screenshots. JPG isn't lossless and any re-compression (e.g.
by adding an arrow, clipping) makes things even worse. Convert them to
JPG in the very last step (if you must).
Also: how about scaling your browser to 200% before you take your
screenshots?
HTH, Peter
Am 21.11.2012 15:55, schrieb Guy Stalnaker:
> Thanks - see my first post for a link to a web folder where you can find the .tex file, the .pdf context produces, two screenshots of the differing image treatment and two of the image files shown in the screenshots.
>
>
> Guy Stalnaker
> jstalnak@wisc.edu
> jimmyg521@gmail.com
>
> On Nov 21, 2012, at 8:35 AM, Sietse Brouwer <sbbrouwer@gmail.com> wrote:
>
>> Guy Stalnaker <jstalnak@wisc.edu> wrote:
>>> I get the same results using texexec and context which means, if I understand rightly, I have used both MkII and MkIV.
>>
>> Yes, this is correct.
>>
>>> Interestingly I get similar results using oft as the pandit output.
>>
>> That does suggest it might be something in the image metadata, too. Is
>> the image file something you can share? If so, perhaps you could share
>> it on the list as an attachment (this mailing list allows
>> attachments), so we could have a go at getting it to work ourselves.
>>
>> Cheers,
>> Sietse
>> ___________________________________________________________________________________
>> If your question is of interest to others as well, please add an entry to the Wiki!
>>
>> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
>> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
>> archive : http://foundry.supelec.fr/projects/contextrev/
>> wiki : http://contextgarden.net
>> ___________________________________________________________________________________
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive : http://foundry.supelec.fr/projects/contextrev/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________
>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <CAF=dkzwfNWgMQpGe3HXeuAZxpCjmzvJTHxxb-2pK6zKJ3+uBPw@mail.gmail.com>]
* Re: Images in MultiMarkdown -> context -> PDF
[not found] ` <CAF=dkzwfNWgMQpGe3HXeuAZxpCjmzvJTHxxb-2pK6zKJ3+uBPw@mail.gmail.com>
@ 2012-11-21 18:17 ` Guy Stalnaker
2012-11-21 20:36 ` Sietse Brouwer
0 siblings, 1 reply; 11+ messages in thread
From: Guy Stalnaker @ 2012-11-21 18:17 UTC (permalink / raw)
To: Sietse Brouwer, mailing list for ConTeXt users
Well, that lead to an interesting experiment. I used convert to
-resample a set of images to 300dpi and redid the compile. They are all
now too bod, many off the right side of the page. Then did the same but
set to 72. They are still too big. Odd, from too small to too big.
I will try and be a bit more precise and craft a text doc to play with
this and report the results.
Thanks for your help!
Guy
On 11/21/2012 10:51 AM, Sietse Brouwer wrote:
> On Wed, Nov 21, 2012 at 3:55 PM, Guy Stalnaker <jstalnak@wisc.edu> wrote:
>> Thanks - see my first post for a link to a web folder where you can find the .tex file, the .pdf context produces, two screenshots of the differing image treatment and two of the image files shown in the screenshots.
>
> Gah --- missed that. Thanks!
>
> The resolution of the image is is either not correctly set, or not
> correctly read by ConTeXt --- so ConTeXt assumes 300dpi instead of 72.
> I've attached a self-made image of 547px wide, and run the following
> file:
>
> \starttext
> \externalfigure[CMSLogin.jpg] \crlf
> \figurenaturalwidth\ -- \figurexresolution\ -- \figurexsize
>
> \externalfigure[cross.jpg] \crlf
> \figurenaturalwidth\ -- \figurexresolution\ -- \figurexsize
> \stoptext
>
> This prints the following dimensions for your figure and the Gimp-made
> one, respectively:
>
> 8635829sp – 0 – 547
> 35982623sp – 72 – 547
>
> Can't remember how to convert scaled points to inches, so here's some
> fraction juggling instead.
> The naturalwidth of the cross is 4.2 times larger:
> 35982623 / 8635829
> = 4.166667
>
> So the login jpg will have 4.16666666 times as many dpi.
> 72 * 4.166667
> = 300 dpi
>
> Which corresponds to this observation by you:
>
>> But note that I attempted to test the dpi theory by
>> selecting an image and using GIMP to set its
>> dpi to 300 yet that resulted in no visible change.
>
> What if you use the GIMP to set its dpi to 72?
>
> --Sietse
>
--
"There is only love, and then oblivion. Love is all we have
to set against hatred." (paraphrased) Ian McEwan
Guy Stalnaker, I^2@DOIT, 1210 West Dayton Street, Room 3209 CSS, Madison
WI 53719-1220, jstalnak@wisc.edu, work 608.263.8035, cell 608.235.4718,
fax 608.265.6681,
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Images in MultiMarkdown -> context -> PDF
2012-11-21 18:17 ` Guy Stalnaker
@ 2012-11-21 20:36 ` Sietse Brouwer
2012-11-23 21:34 ` Guy Stalnaker
2012-11-23 23:25 ` Guy Stalnaker
0 siblings, 2 replies; 11+ messages in thread
From: Sietse Brouwer @ 2012-11-21 20:36 UTC (permalink / raw)
To: Guy Stalnaker; +Cc: mailing list for ConTeXt users
Guy wrote:
> Well, that lead to an interesting experiment. I used convert to -resample a
> set of images to 300dpi and redid the compile. They are all now too bod,
> many off the right side of the page. Then did the same but set to 72. They
> are still too big. Odd, from too small to too big.
I think you don't want -resample, but -density:
# density given in dpi
convert pic.jpg -density 72 pic-out.jpg
convert -density keeps the pixel size and changes the display size by
setting the density metadata.
convert -resample keeps the display size and changes the pixel size by
resampling at a certain density. (This explains why the picture
remained the same too-large size when you resampled at 72 and 300
dpi.)
Because you want to change the display size (and also because
resampling is a lossy process), I think you want -density.
As for the density value you want to use:
Your picture is 547px wide, so if you want it to display it 3 inches
wide you should set its density metadata to 547/3 = 183 dpi.
Does this work?
All the best,
Sietse
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Images in MultiMarkdown -> context -> PDF
2012-11-21 20:36 ` Sietse Brouwer
@ 2012-11-23 21:34 ` Guy Stalnaker
2012-11-23 21:45 ` Aditya Mahajan
2012-11-23 23:25 ` Guy Stalnaker
1 sibling, 1 reply; 11+ messages in thread
From: Guy Stalnaker @ 2012-11-23 21:34 UTC (permalink / raw)
To: Sietse Brouwer; +Cc: mailing list for ConTeXt users
Sietse,
I have confirmed, after significant testing, that 'convert -density 72'
against existing non-png images produces the expected results in context
output pdf documents.
But I'm left with another problem, again something that becomes apparent
as the difference between having two output formats in my document
workflow: markdown -> pandoc -> html/text -> context tex -> pdf. This
time it's images that are too wide for the available textarea in the pdf
document. Now that the dpi is set, they display at the expected full
resolution, yet if they are greater than 6.5*72=438 pixels, they go over
the right margin. I know I can, individually, modify each
/externalfigure directive and add 'width=\textwidth', but that really is
a PITA. This document will have close to a hundred images.
I will investigate using a commandline script, exif data, and convert to
work through all of the images in the folder to scale/resize them so
that they fit in the PDF document margin width. I don't think that the
html version will suffer if I do this.
So, again, thanks for your help!
Best regards,
Guy S.
On 11/21/2012 02:36 PM, Sietse Brouwer wrote:
> Guy wrote:
>> Well, that lead to an interesting experiment. I used convert to -resample a
>> set of images to 300dpi and redid the compile. They are all now too bod,
>> many off the right side of the page. Then did the same but set to 72. They
>> are still too big. Odd, from too small to too big.
> I think you don't want -resample, but -density:
>
> # density given in dpi
> convert pic.jpg -density 72 pic-out.jpg
>
> convert -density keeps the pixel size and changes the display size by
> setting the density metadata.
> convert -resample keeps the display size and changes the pixel size by
> resampling at a certain density. (This explains why the picture
> remained the same too-large size when you resampled at 72 and 300
> dpi.)
>
> Because you want to change the display size (and also because
> resampling is a lossy process), I think you want -density.
>
> As for the density value you want to use:
> Your picture is 547px wide, so if you want it to display it 3 inches
> wide you should set its density metadata to 547/3 = 183 dpi.
>
> Does this work?
> All the best,
> Sietse
--
"There is only love, and then oblivion. Love is all we have
to set against hatred." (paraphrased) Ian McEwan
Guy Stalnaker, I^2@DOIT, 1210 West Dayton Street, Room 3209 CSS, Madison
WI 53719-1220, jstalnak@wisc.edu, work 608.263.8035, cell 608.235.4718,
fax 608.265.6681, page page-guy@watchdog.doit.wisc.edu
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Images in MultiMarkdown -> context -> PDF
2012-11-23 21:34 ` Guy Stalnaker
@ 2012-11-23 21:45 ` Aditya Mahajan
0 siblings, 0 replies; 11+ messages in thread
From: Aditya Mahajan @ 2012-11-23 21:45 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Fri, 23 Nov 2012, Guy Stalnaker wrote:
> But I'm left with another problem, again something that becomes apparent as
> the difference between having two output formats in my document workflow:
> markdown -> pandoc -> html/text -> context tex -> pdf. This time it's images
> that are too wide for the available textarea in the pdf document. Now that
> the dpi is set, they display at the expected full resolution, yet if they are
> greater than 6.5*72=438 pixels, they go over the right margin. I know I can,
> individually, modify each /externalfigure directive and add
> 'width=\textwidth', but that really is a PITA. This document will have close
> to a hundred images.
>
> I will investigate using a commandline script, exif data, and convert to work
> through all of the images in the folder to scale/resize them so that they fit
> in the PDF document margin width. I don't think that the html version will
> suffer if I do this.
\setupexternalfigures[maxwidth=\textwidth]
Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Images in MultiMarkdown -> context -> PDF
2012-11-21 20:36 ` Sietse Brouwer
2012-11-23 21:34 ` Guy Stalnaker
@ 2012-11-23 23:25 ` Guy Stalnaker
1 sibling, 0 replies; 11+ messages in thread
From: Guy Stalnaker @ 2012-11-23 23:25 UTC (permalink / raw)
To: Sietse Brouwer; +Cc: mailing list for ConTeXt users
In case anyone else has been following this thread, here is the shell
script I wrote to resize an image width to 6.5x72dpi so they fit in the
standard letter pagesize \textwidth with 1-inch margins and add image
density/resolution information so that context correctly sizes them in
the PDF output file.
<code>
#!/bin/bash
#set -x
TEXTWIDTH="438" #6.5inches x 72 dpi
for i in *.jpg ;
do
SIZEX="$(exiftool -imagewidth $i | awk '{print $4}')"
SIZEY="$(exiftool -imageheight $i | awk '{print $4}')"
echo "Image $i is $SIZEX x $SIZEY, max X is $TEXTWIDTH ..."
if [[ $SIZEX > $TEXTWIDTH ]] ; then
convert $i -resize $TEXTWIDTH -density 72 $i
echo "resized image $i from $SIZEX to $TEXTWIDTH."
fi
done
</code>
Regards,
Guy
On 11/21/2012 02:36 PM, Sietse Brouwer wrote:
> Guy wrote:
>> Well, that lead to an interesting experiment. I used convert to -resample a
>> set of images to 300dpi and redid the compile. They are all now too bod,
>> many off the right side of the page. Then did the same but set to 72. They
>> are still too big. Odd, from too small to too big.
> I think you don't want -resample, but -density:
>
> # density given in dpi
> convert pic.jpg -density 72 pic-out.jpg
>
> convert -density keeps the pixel size and changes the display size by
> setting the density metadata.
> convert -resample keeps the display size and changes the pixel size by
> resampling at a certain density. (This explains why the picture
> remained the same too-large size when you resampled at 72 and 300
> dpi.)
>
> Because you want to change the display size (and also because
> resampling is a lossy process), I think you want -density.
>
> As for the density value you want to use:
> Your picture is 547px wide, so if you want it to display it 3 inches
> wide you should set its density metadata to 547/3 = 183 dpi.
>
> Does this work?
> All the best,
> Sietse
--
"There is only love, and then oblivion. Love is all we have
to set against hatred." (paraphrased) Ian McEwan
Guy Stalnaker, I^2@DOIT, 1210 West Dayton Street, Room 3209 CSS, Madison
WI 53719-1220, jstalnak@wisc.edu, work 608.263.8035, cell 608.235.4718,
fax 608.265.6681, page page-guy@watchdog.doit.wisc.edu
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2012-11-23 23:25 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-21 4:42 Images in MultiMarkdown -> context -> PDF Guy Stalnaker
2012-11-21 10:07 ` Martin Schröder
2012-11-21 13:21 ` Guy Stalnaker
2012-11-21 14:35 ` Sietse Brouwer
2012-11-21 14:55 ` Guy Stalnaker
2012-11-21 17:44 ` Peter Rolf
[not found] ` <CAF=dkzwfNWgMQpGe3HXeuAZxpCjmzvJTHxxb-2pK6zKJ3+uBPw@mail.gmail.com>
2012-11-21 18:17 ` Guy Stalnaker
2012-11-21 20:36 ` Sietse Brouwer
2012-11-23 21:34 ` Guy Stalnaker
2012-11-23 21:45 ` Aditya Mahajan
2012-11-23 23:25 ` Guy Stalnaker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).