ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Image compression/resizing in PDFs
@ 2011-10-21  9:54 John Devereux
  2011-10-21 13:20 ` Peter Münster
  2011-10-24 13:46 ` Hans Hagen
  0 siblings, 2 replies; 5+ messages in thread
From: John Devereux @ 2011-10-21  9:54 UTC (permalink / raw)
  To: ntg-context


Hi all,

Is there a way to have context automatically compress or resample
included images to a given output resolution? I have not been following
recent developments...

I can obviously "pre-reduce" all images to the desired dpi. But:

1) This is a bit of work (and hard to get non-technical people to do)

2) In 5 years time we might want the images to be higher resolution and
not be as concerned about PDF size. But the information will be lost (or
be elsewhere).

So a command line or document setting would be ideal, is there such a
thing? \setpdfimageresolution[300dpi].

Thanks,

-- 

John Devereux
___________________________________________________________________________________
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] 5+ messages in thread

* Re: Image compression/resizing in PDFs
  2011-10-21  9:54 Image compression/resizing in PDFs John Devereux
@ 2011-10-21 13:20 ` Peter Münster
  2011-10-24 13:46 ` Hans Hagen
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Münster @ 2011-10-21 13:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, Oct 21 2011, John Devereux wrote:

> Is there a way to have context automatically compress or resample
> included images to a given output resolution?

Hello,

See also
http://archive.contextgarden.net/thread/20110629.173015.6dcd7b3e.en.html

t-degrade.tex is broken with latest context. If you fix it (should be
easy), please send me the patch! :-)
(Sorry, too busy now for fixing it myself...)

-- 
           Peter
___________________________________________________________________________________
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] 5+ messages in thread

* Re: Image compression/resizing in PDFs
  2011-10-21  9:54 Image compression/resizing in PDFs John Devereux
  2011-10-21 13:20 ` Peter Münster
@ 2011-10-24 13:46 ` Hans Hagen
  2011-10-24 14:29   ` Aditya Mahajan
  1 sibling, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2011-10-24 13:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: John Devereux

On 21-10-2011 11:54, John Devereux wrote:
>
> Hi all,
>
> Is there a way to have context automatically compress or resample
> included images to a given output resolution? I have not been following
> recent developments...
>
> I can obviously "pre-reduce" all images to the desired dpi. But:
>
> 1) This is a bit of work (and hard to get non-technical people to do)
>
> 2) In 5 years time we might want the images to be higher resolution and
> not be as concerned about PDF size. But the information will be lost (or
> be elsewhere).
>
> So a command line or document setting would be ideal, is there such a
> thing? \setpdfimageresolution[300dpi].

You can plug in a converter:

\startluacode

figures.converters["png"] = {
     ["lowres.png"] = function(oldname,newname,resolution)
         os.execute(string.format('gm convert -depth 1 "%s" 
"%s"',oldname,newname))
     end,
}

-- the following is automatic in next beta

figures.suffixes["lowres.png"] = figures.suffixes.png

\stopluacode

And then use:

\starttext
     \externalfigure[mill.png][conversion=lowres.png]
\stoptext

downsamples images are cached so the overhead is minimal

Hans



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 5+ messages in thread

* Re: Image compression/resizing in PDFs
  2011-10-24 13:46 ` Hans Hagen
@ 2011-10-24 14:29   ` Aditya Mahajan
  2011-10-24 14:49     ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Aditya Mahajan @ 2011-10-24 14:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> downsamples images are cached so the overhead is minimal

Is caching based only on the figure name? If I change the original figure, 
will the cached figure be updated?

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] 5+ messages in thread

* Re: Image compression/resizing in PDFs
  2011-10-24 14:29   ` Aditya Mahajan
@ 2011-10-24 14:49     ` Hans Hagen
  0 siblings, 0 replies; 5+ messages in thread
From: Hans Hagen @ 2011-10-24 14:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 24-10-2011 16:29, Aditya Mahajan wrote:
>> downsamples images are cached so the overhead is minimal
>
> Is caching based only on the figure name? If I change the original
> figure, will the cached figure be updated?

Sure,

                     local oldtime = 
lfs.attributes(oldname,'modification') or 0
                     local newtime = 
lfs.attributes(newname,'modification') or 0
                     if newtime == 0 or oldtime > newtime then

In fact it's just integration of old resource library code (ruby stuff 
that happened between runs).

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2011-10-24 14:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-21  9:54 Image compression/resizing in PDFs John Devereux
2011-10-21 13:20 ` Peter Münster
2011-10-24 13:46 ` Hans Hagen
2011-10-24 14:29   ` Aditya Mahajan
2011-10-24 14:49     ` Hans Hagen

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).