ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Convert tif to jpg (instead of pdf)
@ 2023-07-21 11:25 denis.maier
  2023-07-24 10:20 ` [NTG-context] " denis.maier
  0 siblings, 1 reply; 2+ messages in thread
From: denis.maier @ 2023-07-21 11:25 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 512 bytes --]

Hi,

According to the documentation, it is possible to automatically convert TIFF images to a format supported by LMTX via GraphicsMagick.
https://wiki.contextgarden.net/Using_Graphics#Image_Conversion

However, by default this produces pdf files which are quite huge. is it possible to instruct grapichsmagick to convert tiff images to jpg instead of to pdf ? There's an example on the linked page in the documentation, but I have to admit that I don't quite understand what I should do...

Best
Denis

[-- Attachment #1.2: Type: text/html, Size: 2584 bytes --]

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

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [NTG-context] Re: Convert tif to jpg (instead of pdf)
  2023-07-21 11:25 [NTG-context] Convert tif to jpg (instead of pdf) denis.maier
@ 2023-07-24 10:20 ` denis.maier
  0 siblings, 0 replies; 2+ messages in thread
From: denis.maier @ 2023-07-24 10:20 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 1377 bytes --]

Partial success:

I haven't been able to convert the images to jpg proper, but I've been at least been able to enable jpeg compression, thus making the resulting pdfs much smaller:

% enable compression for tiffs
\startluacode
local function compress(oldname, newname, compression)
    if not compression or compression == "" then
        compression = "jpeg"
    end
    os.execute(string.format(
        'gm convert -compress %s "%s" "%s"',
        compression, oldname, newname)
   )
end

-- Set the PDF and default TIFF converters to the above function.
figures.converters.tif.pdf = compress
figures.converters.tif.default = compress
\stopluacode

Best,
Denis

Von: denis.maier@unibe.ch <denis.maier@unibe.ch>
Gesendet: Freitag, 21. Juli 2023 13:25
An: ntg-context@ntg.nl
Betreff: [NTG-context] Convert tif to jpg (instead of pdf)

Hi,

According to the documentation, it is possible to automatically convert TIFF images to a format supported by LMTX via GraphicsMagick.
https://wiki.contextgarden.net/Using_Graphics#Image_Conversion

However, by default this produces pdf files which are quite huge. is it possible to instruct grapichsmagick to convert tiff images to jpg instead of to pdf ? There's an example on the linked page in the documentation, but I have to admit that I don't quite understand what I should do...

Best
Denis

[-- Attachment #1.2: Type: text/html, Size: 5429 bytes --]

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

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-24 10:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-21 11:25 [NTG-context] Convert tif to jpg (instead of pdf) denis.maier
2023-07-24 10:20 ` [NTG-context] " denis.maier

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