Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #773 > unrolled thread

How to integrate a graphic (jpg) in a postscript file

Started byCecil Westerhof <Cecil@decebal.nl>
First post2012-07-02 00:32 +0200
Last post2012-07-12 18:18 -0700
Articles 5 — 5 participants

Back to article view | Back to comp.lang.postscript


Contents

  How to integrate a graphic (jpg) in a postscript file Cecil Westerhof <Cecil@decebal.nl> - 2012-07-02 00:32 +0200
    Re: How to integrate a graphic (jpg) in a postscript file Mark Carroll <mtbc@bcs.org> - 2012-07-01 18:46 -0400
      Re: How to integrate a graphic (jpg) in a postscript file ken <ken@spamcop.net> - 2012-07-02 08:00 +0100
    Re: How to integrate a graphic (jpg) in a postscript file Helge Blischke <h.blischke@acm.org> - 2012-07-02 19:11 +0200
    Re: How to integrate a graphic (jpg) in a postscript file Don Lancaster <don@tinaja.com> - 2012-07-12 18:18 -0700

#773 — How to integrate a graphic (jpg) in a postscript file

FromCecil Westerhof <Cecil@decebal.nl>
Date2012-07-02 00:32 +0200
SubjectHow to integrate a graphic (jpg) in a postscript file
Message-ID<87fw9bqfhy.fsf@Compaq.site>
I want to include an image (jpeg) into my postscript file. Until know
I only found a kind of hex-dump into the postscript file. Is there a
(preferable) simple method to include a (changing) graphic into a
postscript file?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [next] | [standalone]


#774

FromMark Carroll <mtbc@bcs.org>
Date2012-07-01 18:46 -0400
Message-ID<87ehovumjm.fsf@ixod.org>
In reply to#773
Cecil Westerhof <Cecil@decebal.nl> writes:

> I want to include an image (jpeg) into my postscript file. Until know
> I only found a kind of hex-dump into the postscript file. Is there a
> (preferable) simple method to include a (changing) graphic into a
> postscript file?

I don't know if there's some open-source JPEG decoder implemented in
PostScript itself. Usually I just use the free netpbm package: jpegtopnm
to rasterize it, then pnmtops to produce EPS which is easily included as
part of other PS. The resulting EPS can be rather large though.

Mark

[toc] | [prev] | [next] | [standalone]


#775

Fromken <ken@spamcop.net>
Date2012-07-02 08:00 +0100
Message-ID<MPG.2a5b572247299f7498988c@usenet.plus.net>
In reply to#774
In article <87ehovumjm.fsf@ixod.org>, mtbc@bcs.org says...
> > I only found a kind of hex-dump into the postscript file. Is there a
> > (preferable) simple method to include a (changing) graphic into a
> > postscript file?
> 
> I don't know if there's some open-source JPEG decoder implemented in
> PostScript itself.

The PostScript language includes the DCTDecode filter, so any 
implementation of a PostScritp interpreter has to be able to handle DCT 
data, whether it is open source or not.

> Usually I just use the free netpbm package: jpegtopnm
> to rasterize it, then pnmtops to produce EPS which is easily included as
> part of other PS. The resulting EPS can be rather large though.

Because removing the DCT compression makes a large bitmap, even if its 
compressed with some other method. Using DCT compression ondata which 
was originally DCT compressed results in ugly artefacts.



As JPEG uses DCT compression, and PostScript includes DCT dedcoding, it 
is a comparatively simple matter to turn a JPEG file into something 
which can be embedded in a PostScript file. As a result there are any 
number of utilities which will do the job, a quick Google will find them 
for you. In many cases they come supplied with source code so you can 
see whhat the utility is doing.

Because PostScript is a programming language you can even write the 
inclusion code in PostScript. See the 'viewjpeg.ps' file in the 
Ghostscript 'lib' directory if you have Ghostscript installed.

However I would need more details on what you are trying to achieve,its 
almost invariably better to include the image data using the application 
generting the PostScript than to modify the PostScript program after 
creation.


			Ken

[toc] | [prev] | [next] | [standalone]


#776

FromHelge Blischke <h.blischke@acm.org>
Date2012-07-02 19:11 +0200
Message-ID<a5e330Fpf3U1@mid.individual.net>
In reply to#773
Cecil Westerhof wrote:

> I want to include an image (jpeg) into my postscript file. Until know
> I only found a kind of hex-dump into the postscript file. Is there a
> (preferable) simple method to include a (changing) graphic into a
> postscript file?
> 

I have a set of PostScript procedures to render - among others - JPEG 
images; see the following description. Drop me an e-mail if this is an
option for you.

Helge

-----------------------------snip-----------------------------------
% Description
% -----------
%       This procset adds basic support of baseline JPEG streams suppled as
%       separate files to tiffifd and tiffimg, respectively, according to
%       the Technote TTN 2 by Adobe.
%
%       Image files starting with 0xffd8 (JPEG SOI marker) are interpreted as
%       JPEG streams.
%       The following markers are interpreted:
%       APP0  JFIF
%               ResolutionUnit, XResolution, and Yresolution are extracted;
%               the thumbnail information, if present, is skipped.
%       APP0  JFXX
%               is only treated as a valid marker, the contents is skipped.
%       APP13 Photoshop:
%               If present, color values are inverted; the rest of this marker
%               is skipped.
%       APP14 Adobe
%               Used to determine the ColorTransform parameter for the
%               DCTDecode filter.
%       SOFn (n = 0, 1, 3)
%               Used to extract the image dimensions, number of colors,
%               and to do an educated guess on ColorTransform it the
%               Adobe marker has not been found.
%
%       The header interpretation stops with the first SOF marker found.
%
% Requirements:
% -------------
%       tiffifd 1.2 3   or higher
%       tiffimg 1.1 4   or higher
%
% Restrictions:
% -------------
%       Currently, stripped or tiled JPEG streams are not supported. The
%       whole image file is treated as a single strip with respect to the TIFF
%       conventions, and we rely on the JPEG stream as a whole being
%       compatible with the PostScript DCTDEcode filter.
%       Only some basic compatibility checks are performed
%       (8 bits per sample, 1, 3, or 4 samples per pixel).
%       The color spaces supported are DeviceGray, DeviceRGB, and DeviceCMYK;
%       but see the remarks on ColorTransform above.

--------------------snip--------------------

[toc] | [prev] | [next] | [standalone]


#791

FromDon Lancaster <don@tinaja.com>
Date2012-07-12 18:18 -0700
Message-ID<4FFF7778.7040909@tinaja.com>
In reply to#773
On 7/1/2012 3:32 PM, Cecil Westerhof wrote:
> I want to include an image (jpeg) into my postscript file. Until know
> I only found a kind of hex-dump into the postscript file. Is there a
> (preferable) simple method to include a (changing) graphic into a
> postscript file?
>


Simply printing a JPEG file to distiller will handle this, so there is 
rarely any need for anything fancier.

If you really want to get fancy, then
< http://www.tinaja.com/glib/jpg2pdf.pdf >

More at  < http://www.tinaja.com/pssamp1.shtml >

-- 
Many thanks,

Don Lancaster                          voice phone: (928)428-4073
Synergetics   3860 West First Street   Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml   email: don@tinaja.com

Please visit my GURU's LAIR web site at http://www.tinaja.com

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.postscript


csiph-web