ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Which Image quality should I use ?
@ 2014-07-12 12:58 Pol Stra
  2014-07-12 14:14 ` Peter Münster
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Pol Stra @ 2014-07-12 12:58 UTC (permalink / raw)
  To: ntg-context

Hello everyone,

this is a question a little out of topic, but I think there are here people 
used to this concerns who can give me an answer.

I have several images I want to put in my document:

$-> mediainfo "mypicture.png"                                                                            

General
Complete name                            : mypicture.png
Format                                   : PNG
Format/Info                              : Portable Network Graphic
File size                                : 5.19 MiB

Image
Format                                   : PNG
Format/Info                              : Portable Network Graphic
Width                                    : 1 600 pixels
Height                                   : 1 600 pixels
Bit depth                                : 32 bits
Compression mode                         : Lossless
Stream size                              : 5.19 MiB (100%)

Of course, this makes a huge pdf (I put the source in a zip file attached to 
the pdf so data are replicated). I wonder, what can I do to reduce the size of 
those files while keeping a printable quality document?

I think I should do something like:
`convert -density 300 input.png -resize AAAxBBB output.png`

but I don't know if it’s the good way to do it or which resolution is 
appropriate.

Best regards,

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

* Re: Which Image quality should I use ?
  2014-07-12 12:58 Which Image quality should I use ? Pol Stra
@ 2014-07-12 14:14 ` Peter Münster
  2014-07-13  7:59   ` Pol Stra
  2014-07-13 10:06 ` Henning Hraban Ramm
  2014-07-13 11:10 ` Joshua Krämer
  2 siblings, 1 reply; 8+ messages in thread
From: Peter Münster @ 2014-07-12 14:14 UTC (permalink / raw)
  To: ntg-context

On Sat, Jul 12 2014, Pol Stra wrote:

> I think I should do something like:
> `convert -density 300 input.png -resize AAAxBBB output.png`
>
> but I don't know if it’s the good way to do it

Hi,

I can be done automatically for example by using this module:
http://modules.contextgarden.net/grph-downsample


> or which resolution is appropriate.

It depends on the printer. 300dpi is often enough.

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

* Re: Which Image quality should I use ?
  2014-07-12 14:14 ` Peter Münster
@ 2014-07-13  7:59   ` Pol Stra
  2014-07-15 17:03     ` Peter Münster
  0 siblings, 1 reply; 8+ messages in thread
From: Pol Stra @ 2014-07-13  7:59 UTC (permalink / raw)
  To: ntg-context; +Cc: Peter Münster

Le samedi 12 juillet 2014, 16:14:25 Peter Münster a écrit :
> On Sat, Jul 12 2014, Pol Stra wrote:
> > I think I should do something like:
> > `convert -density 300 input.png -resize AAAxBBB output.png`
> > 
> > but I don't know if it’s the good way to do it
> 
> Hi,
> 
> I can be done automatically for example by using this module:
> http://modules.contextgarden.net/grph-downsample
> 

Thank you, it looks interesting. Is there a documentation somewhere or could 
you provide an example about how to use it ?

Also, it changes the resolution only at inclusion into the pdf or it does it 
on original files ? My concern is to give the sources in attachment of the 
document, so if I don't change those files, the document will still be huge. 

There is a way to include the source without duplicates images ?

> > or which resolution is appropriate.
> 
> It depends on the printer. 300dpi is often enough.

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

* Re: Which Image quality should I use ?
  2014-07-12 12:58 Which Image quality should I use ? Pol Stra
  2014-07-12 14:14 ` Peter Münster
@ 2014-07-13 10:06 ` Henning Hraban Ramm
  2014-07-13 11:10 ` Joshua Krämer
  2 siblings, 0 replies; 8+ messages in thread
From: Henning Hraban Ramm @ 2014-07-13 10:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 2014-07-12 um 18:58 schrieb Pol Stra <ryzz@hotmail.fr>:

> I wonder, what can I do to reduce the size of 
> those files while keeping a printable quality document?

For color or greyscale pictures that are (like) photos, 150 dpi in final size is mostly enough, even for quality offset printing.

„In final size“ = not scaled up

If you have fine lines, like diagrams or scanned text, you might need 300 dpi. For black & white lineart, you should use the resolution of your printer, but even for offset printing 800 dpi is enough (more than 1200 dpi are always nonsense).

Greetlings, Hraban
---
http://www.fiee.net/texnique/
http://wiki.contextgarden.net
https://www.cacert.org (I'm an assurer)

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

* Re: Which Image quality should I use ?
  2014-07-12 12:58 Which Image quality should I use ? Pol Stra
  2014-07-12 14:14 ` Peter Münster
  2014-07-13 10:06 ` Henning Hraban Ramm
@ 2014-07-13 11:10 ` Joshua Krämer
  2 siblings, 0 replies; 8+ messages in thread
From: Joshua Krämer @ 2014-07-13 11:10 UTC (permalink / raw)
  To: ntg-context-wvrSQK3plZs

On 2014-07-12, 14:58, Pol Stra wrote:

> I wonder, what can I do to reduce the size of those files while
> keeping a printable quality document?

Besides reducing the resolution, you can reduce the number of colours
used in a PNG picture, which is called colour quantization.  For
example, we can differentiate between ca. 12 levels of gray (between
black and white) with our eyes.  So it is useless to differentiate
between hundreds of different colours in a gray picture.  I quantize
all my gray pictures to use 12 colours only, and the difference is
usually not visible, but it leads to a much smaller file size.  For
coloured pictures, you need of course more different colours, you have
to try different values with each picture to find the best number.  I
use the tool pngnq for quantization.

After quantization, one can further losslessy compress an image by
removing unnecessary meta informations from the file, which can be
done automatically with the tool Trimage.

I've got both pngnq and Trimage from the repositories of my Linux
distribution.

Kind regards,
Joshua


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context-wvrSQK3plZs@public.gmane.org / 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] 8+ messages in thread

* Re: Which Image quality should I use ?
  2014-07-13  7:59   ` Pol Stra
@ 2014-07-15 17:03     ` Peter Münster
  2014-07-15 17:13       ` Aditya Mahajan
  2014-07-15 19:52       ` Hans Hagen
  0 siblings, 2 replies; 8+ messages in thread
From: Peter Münster @ 2014-07-15 17:03 UTC (permalink / raw)
  To: ntg-context

On Sun, Jul 13 2014, Pol Stra wrote:

>> I can be done automatically for example by using this module:
>> http://modules.contextgarden.net/grph-downsample
>
> Thank you, it looks interesting. Is there a documentation somewhere or could 
> you provide an example about how to use it ?

Hi,

Here an example: http://wiki.contextgarden.net/Catalogue_raisonné


> Also, it changes the resolution only at inclusion into the pdf or it does it 
> on original files ? My concern is to give the sources in attachment of the 
> document, so if I don't change those files, the document will still be huge. 

The downscaled images are kept on disk in the "cache" sub-directory.


> There is a way to include the source without duplicates images ?

Yes.


There is also an old module t-degrade.tex but I don't know, if it still
works with recent ConTeXt versions.

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

* Re: Which Image quality should I use ?
  2014-07-15 17:03     ` Peter Münster
@ 2014-07-15 17:13       ` Aditya Mahajan
  2014-07-15 19:52       ` Hans Hagen
  1 sibling, 0 replies; 8+ messages in thread
From: Aditya Mahajan @ 2014-07-15 17:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 536 bytes --]

On Tue, 15 Jul 2014, Peter Münster wrote:

> There is also an old module t-degrade.tex but I don't know, if it still
> works with recent ConTeXt versions.

It is possible to create a wrapper around t-filter to provide the 
functionality of t-degrade and/or grph-downsample, so that one could use:

    \downsample[filename][options]

The main advantage is that one can use all the options of t-filter module: 
specify the cache directory, force reruns, etc. Let me know if there is 
any interest in such a wrapper.

Aditya

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

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

* Re: Which Image quality should I use ?
  2014-07-15 17:03     ` Peter Münster
  2014-07-15 17:13       ` Aditya Mahajan
@ 2014-07-15 19:52       ` Hans Hagen
  1 sibling, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2014-07-15 19:52 UTC (permalink / raw)
  To: ntg-context

On 7/15/2014 7:03 PM, Peter Münster wrote:
> On Sun, Jul 13 2014, Pol Stra wrote:
>
>>> I can be done automatically for example by using this module:
>>> http://modules.contextgarden.net/grph-downsample
>>
>> Thank you, it looks interesting. Is there a documentation somewhere or could
>> you provide an example about how to use it ?
>
> Hi,
>
> Here an example: http://wiki.contextgarden.net/Catalogue_raisonné
>
>
>> Also, it changes the resolution only at inclusion into the pdf or it does it
>> on original files ? My concern is to give the sources in attachment of the
>> document, so if I don't change those files, the document will still be huge.
>
> The downscaled images are kept on disk in the "cache" sub-directory.
>
>
>> There is a way to include the source without duplicates images ?
>
> Yes.
>
>
> There is also an old module t-degrade.tex but I don't know, if it still
> works with recent ConTeXt versions.

so you have several options:

- using build in
- using specific modules

built in boils down to something

\startluacode

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

-- figures.suffixes["lowres.png"] = figures.suffixes.png -- suffix is 
automatically done

\stopluacode

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

in nearly all our projects we get images that need to be converted 
(color -> bw, downsampling, removing crap from pdf, etc) but in most 
cases we also convert to pdf then because that is normally the fastest 
way to include an image (which is why one can also define a prefix and 
cache)

what method you choose depends on how much control you want (it's hard 
to predict demands) ... btw, many of these build-in mechanism are 
derived from mkii methods, where we also had resource manipulators and 
so (we still have figure databases btw)

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

end of thread, other threads:[~2014-07-15 19:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-12 12:58 Which Image quality should I use ? Pol Stra
2014-07-12 14:14 ` Peter Münster
2014-07-13  7:59   ` Pol Stra
2014-07-15 17:03     ` Peter Münster
2014-07-15 17:13       ` Aditya Mahajan
2014-07-15 19:52       ` Hans Hagen
2014-07-13 10:06 ` Henning Hraban Ramm
2014-07-13 11:10 ` Joshua Krämer

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