[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: The road goes ever on
From:       Vadim Plessky <lucy-ples () mtu-net ! ru>
Date:       2002-10-29 17:52:06
[Download RAW message or body]

On Tuesday 29 October 2002 3:49 pm, Dirk Schönberger wrote:
|  > While I highly appreciate idea of using ImageMagick in KDE/KOffice, what
|  about
|  > converting PNG->EPS using GhostScript?
|
|  Do you really mean the conversion of PNG, i.e. image / lower level
|  representation to
|  EPS, i.e. vector data / higher level representation?

It really depends on type of image, flexibility you want, etc. And on quality 
of final EPS file.
Let's take, for example, high-quality and small in size image (attached, 
web-spider-rsvg.png). It is 23K.  I generated it using librsvg-2.1.1, from 
SVG file (4.4K, it is also attached).

I have tried several paths to convert this image to PS (EPS is PS with 
bounding box).

1) First I converetd it using latets stable release of Imagemagick (5.5.1):

[vad@VPlessky Blue-Sphere]$ convert -debug all web-spider-rsvg.png 
web-spider.eps
20:26:23 0.06u Configure[1024]: Searching for module file "modules.mgk" ...
20:26:23 0.12u Configure[1024]:   
/usr/lib/ImageMagick-5.5.1/modules/coders/modules.mgk [Success]
20:26:23 0.21u Cache[1024]: destroy
20:26:23 0.21u Configure[1024]: Searching for configure file "magic.mgk" ...
20:26:23 0.21u Configure[1024]:   /usr/lib/ImageMagick-5.5.1/magic.mgk 
[Success]
20:26:23 0.23u Coder[1024]:  Begin ReadPNGImage()
20:26:23 0.23u Coder[1024]:    Begin reading PNG datastream
20:26:23 0.23u Coder[1024]:      PNG width=160, height=160
20:26:23 0.23u Coder[1024]:      PNG color_type=6, bit_depth=8
20:26:23 0.23u Coder[1024]:      PNG compression_method=0
20:26:23 0.23u Coder[1024]:      PNG interlace_method=0, filter_method=0
20:26:23 0.23u Coder[1024]:      Reading PNG IDAT chunk(s)
20:26:23 0.24u Coder[1024]:      Converting PNG pixels to pixel packets
20:26:23 0.24u Cache[1024]: open web-spider-rsvg.png[0] (200.0k)
20:26:23 0.24u Coder[1024]:    Finished reading PNG datastream.
20:26:23 0.24u Coder[1024]:  End ReadPNGImage()
20:26:23 0.26u Configure[1024]: Searching for configure file "delegates.mgk" 
...
20:26:23 0.26u Configure[1024]:   /usr/lib/ImageMagick-5.5.1/delegates.mgk 
[Success]
20:26:23 0.67u Cache[1024]: destroy web-spider-rsvg.png[0]

Resulting file: 157.7KB
Image has screen resolution.

2) Than I just opened this PNG file in Konqueror (3.1beta2), and printed it to 
PS. :-)
File was 30KB in size, and image is of very high quality.

3) I invoked 
[vad@VPlessky Blue-Sphere]$ imagetops web-spider-rsvg.png > imagetops-res.ps
file: Using regular magic file `/usr/share/magic/magic.mime'
pnmtops: writing color PostScript...

[vad@VPlessky Blue-Sphere]$ locate imagetops
/usr/lib/cups/filter/imagetops
/opt/kde3/share/apps/kdeprint/filters/imagetops.desktop
/opt/kde3/share/apps/kdeprint/filters/imagetops.xml
/opt/kde3/bin/imagetops
[vad@VPlessky Blue-Sphere]$ rpm -qf /opt/kde3/bin/imagetops
kdelibs3-3.1-0.beta2.1mdk

oops! Such a nice utility inside kdelibs :-)

Than I open PS file, and found that PS file was generated by 'pnmtops' 
[vad@VPlessky Blue-Sphere]$ locate pnmtops
/usr/share/man/man1/pnmtops.1.bz2
/usr/bin/pnmtops

[vad@VPlessky Blue-Sphere]$ rpm -qf /usr/bin/pnmtops
netpbm-9.20-2mdk

[vad@VPlessky Blue-Sphere]$ rpm -ql netpbm | grep pnmtops
/usr/bin/pnmtops
/usr/share/man/man1/pnmtops.1.bz2

And man page says:
-------------------------------------
NAME
 pnmtops - convert portable anymap to PostScript 

SYNOPSIS
pnmtops [-scale s] [-dpi n] [-imagewidth n] [-imageheight n] [-width n] 
[-height n] [-equalpixels] [-turn|-noturn] [-rle|-runlength] 
[-center|-nocenter] [pnmfile] 

DESCRIPTION
 Reads a Netpbm image as input. Produces Encapsulated PostScript as output. 

If the input file is in color (PPM), pnmtops generates a color PostScript 
file. Some PostScript interpreters can't handle color PostScript. If you have 
one of these you will need to run your image through ppmtopgm first. 

If you specify no output dimensioning options, the output image is dimensioned 
such that 72 pixels of the input image generate one inch of output image. 
Except if that would exceed the default page size (8.5 inches by 11 inches), 
the output image is shrunk enough to fit. 
-------------------------------------

Again: resulting PS file was 153K, and it has screen resolution.

So, there is at least 3 variants to perfrom your task. Selection is yours :-)

|
|  I don't think Ghostscript is the right tool for this job, because its main
|  goal is mostly reversed, i.e. the conversion of vector data / Postscript
|  calls to a rendered image.

GS is not "right tool" for any task, but until we have couple of good SVG 
renders compliant with SVG 1.1, and QT patched to produce SVG instead of PS 
(WSVGprinter class), we need to "live with GS".

|
|  > BTW:  what GS can't do is to convert SVG or WMF to EPS.  You indeed may
|  > want to use ImageMagick for that task.  SVG support in ImageMagick is
|  > not perfect, but WMF support is quite good!
|
|  Ghostscript is an Postscript interpreter, i.e. its main purpose is
|  interpreting Postscript. EPS, Adobe Illustrator fileformat and to a
| certain extent PDF (Portable Document Format) are Postscript deriatives.
|
|  SVG and WMF clearly aren't. There may be some resemblances in the SVG and
| PS rendering model, but nothing at the language/syntax level.

I just mentioned them, as they are supported by ImageMagick.
But a few people are aware of this fact. :-)

|
|  For WMF support, what is the state of support of WMF in QPicture?
| QPicture's goal seem to be a similar goal as WMF, i.e. a meta file format
| containg render API calls.

Forget about Qt for Vector graphics.
AFAIK Qt is limited by QPainter, so you can't expect from QT something which 
exceeds its capabilities.
That's why there is a KSVG, while Qt3 has support for (rudimentary in 
complexity) SVG files.
This question has been asked, and Trolls answered that they are not going to 
provide reference SVG implemenattion inside QT3.

Hope this clarifies things a little bit.

|
|  Dirk

-- 

Vadim Plessky
http://kde2.newmail.ru  (English)
33 Window Decorations and 6 Widget Styles for KDE
http://kde2.newmail.ru/kde_themes.html
KDE mini-Themes
http://kde2.newmail.ru/themes/


["web-spider.svg.bz2" (application/x-bzip2)]
["web-spider-rsvg.png.bz2" (application/x-bzip2)]
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic