ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: export images
Date: Sat, 21 Mar 2015 13:11:24 +0100	[thread overview]
Message-ID: <04FCFE0C-9E85-4D0F-92AE-60AED90146B4@gmail.com> (raw)
In-Reply-To: <op.xvugwxdifkrasx@ishamid-pc>


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


> Am 21.03.2015 um 12:01 schrieb Idris Samawi Hamid ادريس سماوي حامد <ishamid@colostate.edu>:
> 
> On Sat, 21 Mar 2015 02:55:08 -0600, Wolfgang Schuster <schuster.wolfgang@gmail.com <mailto:schuster.wolfgang@gmail.com>> wrote:
> 
>> 
>>> Am 21.03.2015 um 03:09 schrieb Idris Samawi Hamid ادريس سماوي حامد <ishamid@colostate.edu>:
>>> 
>>> Dear gang,
>>> 
>>> How do we get images in the export? Here is my sample (also attached):
>>> 
>>> ==============
>>> \setupbackend[export=yes]
>>> 
>>> \starttext
>>> \startalignment [middle]
>>> \dontleavehmode
>>> \externalfigure[mill.png]
>>> \stopalignment
>>> \stoptext
>>> ==============
>>> 
>>> div output:
>>> 
>>> ==
>>> <div>
>>>  <div class="image" id="image-1"><!--empty--></div>
>>> </div>
>>> ==
>>> 
>>> So it seems that \externalfigure[mill.png] is tagged in the output but the
>>> image itself is ignored. What am I missing here? pdf output is correct; I
>>> copied mill.png from the context sample folder
>>> 
>>> /tex/texmf-context/tex/context/sample/mill.png
>> 
>> Put mill.png in the images folder which should exist in the export folder.
> 
> Thanks, Wolfgang!
> 
> One more question on this: How can I setup the images so that I don't have to toggle, e.g.
> 
> \externalfigure[basmalah.png][width=3in]
> % \externalfigure[basmalah.pdf][width=3in]
> 
> Is there a way to tell the export to use the png option, while telling the pdf output to use the pdf? This is important when the image is made from a font (no needs scalability in the pdf).

You can try to use the *export mode to use different images for the XML and PDF output.


The first method is to drop the file extension and tell context to use the PNG files when the export is enabled.

%\setupbackend[export=yes] % uncomment to enable *export mode

\startmode[*export]
  \useexternalfigure[basmalah] [basmalah.png]
\stopmode

% possible but not necessary because ConTeXt prefers images in the PDF format
%
% \startnotmode[*export]
%   \useexternalfigure[basmalah] [basmalah.pdf]
% \stopnotmode

\starttext
\externalfigure[basmalah]
\stoptext


The second method is to specify which image should be used when the export is disabled/enabled.

%\setupbackend[export=yes] % uncomment to enable *export mode

\starttext

\doifmodeelse{*export}
  {\externalfigure[basmalah.png]}
  {\externalfigure[basmalah.pdf]}

\stoptext


The third method is to use two folders for the images in PDF and PNG format.

%\setupbackend[export=yes] % uncomment to enable *export mode

\doifmodeelse[*export]
  {\setupexternalfigures[directory=pngimages]}
  {\setupexternalfigures[directory=pdfimages]}

\starttext
\externalfigure[basmalah]
\stoptext


Wolfgang

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

[-- 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
___________________________________________________________________________________

  reply	other threads:[~2015-03-21 12:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-21  2:09 Idris Samawi Hamid ادريس سماوي حامد
2015-03-21  8:55 ` Wolfgang Schuster
2015-03-21 11:01   ` Idris Samawi Hamid ادريس سماوي حامد
2015-03-21 12:11     ` Wolfgang Schuster [this message]
2015-03-21 13:33       ` Idris Samawi Hamid ادريس سماوي حامد

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=04FCFE0C-9E85-4D0F-92AE-60AED90146B4@gmail.com \
    --to=schuster.wolfgang@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).