Re: How to make higher resolution GIF or JPEG image? [message #38021] |
Tue, 17 February 2004 12:35  |
bleau
Messages: 24 Registered: November 1993
|
Junior Member |
|
|
In article <102qkjo6mqkgrd4@corp.supernews.com>, Michael Wallace <mwallace.removethismunge@swri.edu.invalid> writes:
[snip]
> It's not that PS is high resolution -- it's because PS uses vector
> graphics rather than raster graphics. This allows PS viewers to redraw
> the image when the resolution changes.
Okay, that makes sense.
>> Does anyone know of a way to convert PS to GIF? I read about
>> Ghostscript and Ghostview, but the ftp site says they removed the GIF
>> generation capabilities from the package due to licensing problems.
>> Since we're going to be displaying these gif's on the web, that's
>> probably not a way for us to go. Any other ideas?
>
> You can use PNG instead of GIF. PNG is basically a free replacement for
> GIF. It's been supported in IDL for a while and nearly everyone who I
> work with who use to use GIFs now use PNGs. I wouldn't recommend JPEG
> or any other lossy format. And PNGs can be seen without problem in web
> browsers.
That's the concern here: That many folks have web browsers that haven't
been upgraded in a while and won't be able to support PNG. I counselled
against using JPEG, but there's not many alternatives if one rules out PNG.
> Fonts created in IDL direct graphics do not look good at all, and there
> are many here who have voiced similar complaints. One thing you can do
> is use hardware fonts or use object graphics. Another thing you can do
> is the "make 'em big trick" as described here:
> http://www.dfanning.com/graphics_tips/zfonts.html
This technique looks interesting and has possibilities; I'll try it. I'm
writing my entire plot to a Z-buffer, though, not just the text. I guess
that means I should make the entire plot 4x larger in each dimension,
right? REBIN will take care of averaging adjacent pixels together for me.
Lawrence Bleau
University of Maryland
Physics Dept., Space Physics Group
301-405-6223
bleau@umtof.umd.edu
|
|
|
Re: How to make higher resolution GIF or JPEG image? [message #38059 is a reply to message #38021] |
Fri, 13 February 2004 16:26   |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
Larry, just bringing it back to the list...
"Lawrence Bleau" wrote in message...
>>> I want to generate a GIF file with a raster-like plot in it. I know
>>> how to do this using the Z-buffer as a device (SET_PLOT,'Z'). All my
>>> experience with GIF plots on other systems, though, show they display
>>> with slightly jagged lines, as though made on a low-res plot (which
>>> GIF is, I suppose). I have seen, however, GIF plots made by other
>>> packages that have a great look: smooth curves and letters, no
>>> jaggies.
>> You can make the image big, load it into Photoshop (or similar program),
>> convert it to RGB, then resize it, then convert it back to indexed and
>> save as gif. This will give you the buttery look you desire. The key
>> is changing it to RGB format since scaling in indexed mode won't get
>> rid of the aliasing. Heck, you could probably do something like that
>> in IDL.
> The photoshop approach won't work, since I want to be able to do these
> operations in non-interactive mode.
>
> Is there a way to make the RGB in IDL?
Since we're working with the Z buffer (aren't we?) or at least an 8 bit
device, we need to convert to RGB because TVRD(/TRUE) won't work.
This probably won't win any awards but...
image = TVRD()
TVLCT, R, G, B, /GET
s = SIZE(image, /DIMENSIONS)
rImage = BYTARR(s)
gImage = BYTARR(s)
bImage = BYTARR(s)
for n=0, 255 do begin
idx = WHERE(image eq n, count)
if (count gt 0) then begin
rImage[idx] = R[n]
gImage[idx] = G[n]
bImage[idx] = B[n]
endif
endfor
rImage = REBIN(rImage, s/2)
gImage = REBIN(gImage, s/2)
bImage = REBIN(bImage, s/2)
newImage = COLOR_QUAN(rImage, gImage, bImage, R, G, B, $
CUBE=6)
This works o.k. but you'll notice that lines and text will be thinner and
the colors won't be as saturated. Just thicken up lines and text until you
get desirable results. Also, play around with the downsampling (CONGRID vs
REBIN) and the COLOR_QUAN keywords. I don't know what you'll get.
Hopefully this will help.
-Rick
|
|
|
Re: How to make higher resolution GIF or JPEG image? [message #38060 is a reply to message #38059] |
Fri, 13 February 2004 14:40   |
Michael Wallace
Messages: 409 Registered: December 2003
|
Senior Member |
|
|
> I want to generate a GIF file with a raster-like plot in it. I know
> how to do this using the Z-buffer as a device (SET_PLOT,'Z'). All my
> experience with GIF plots on other systems, though, show they display
> with slightly jagged lines, as though made on a low-res plot (which
> GIF is, I suppose). I have seen, however, GIF plots made by other
> packages that have a great look: smooth curves and letters, no
> jaggies.
The jaggedness you see is a result of aliasing. Anti-aliasing is the
process that makes lines and curves appear nice and smooth. There's
plenty on the internet about anti-aliasing, so I won't delve into that
topic here. Basically, a plot will look jagged because each individual
pixel is either on or off; in this case either white or black.
Something that is anti-aliased will have shades of gray along with the
white and black. The grays trick the eyes so that they see a smooth
continuous line. In short, the plot is not anti-aliased; there is
nothing wrong with the GIF format itself.
> I know how to vary the size of the output GIF file: the SET_RESOLUTION
> keyword to the DEVICE command. The problem is that this keyword only
> changes the *size* of the resultant GIF file, not its resolution. If
> I use this keyword, all I get is a large GIF file with jaggies. When
> viewed on a browser, that gives me a larger image. I want the image to
> stay the size that can be displayed on a normal browser window, just
> to have a higher resolution.
Resolution is not the problem. See above paragraph.
> If there's none, I can create an alternate format, such as PostScript,
> that has the high resolution plots. I'd then have to convert it to
> GIF (simply because very few browsers, if any, interpret PS).
It's not that PS is high resolution -- it's because PS uses vector
graphics rather than raster graphics. This allows PS viewers to redraw
the image when the resolution changes.
> Does anyone know of a way to convert PS to GIF? I read about
> Ghostscript and Ghostview, but the ftp site says they removed the GIF
> generation capabilities from the package due to licensing problems.
> Since we're going to be displaying these gif's on the web, that's
> probably not a way for us to go. Any other ideas?
You can use PNG instead of GIF. PNG is basically a free replacement for
GIF. It's been supported in IDL for a while and nearly everyone who I
work with who use to use GIFs now use PNGs. I wouldn't recommend JPEG
or any other lossy format. And PNGs can be seen without problem in web
browsers.
> In particular, take a look at the characters used to label the axes.
> Even at higher resolution they look bad. And yes, I know jaggies are
> usually an artifact of the monitor. Only thing is, I've seen a GIF
> display on a monitor that *didn't* have jaggies, so I know it's
> possible.
Fonts created in IDL direct graphics do not look good at all, and there
are many here who have voiced similar complaints. One thing you can do
is use hardware fonts or use object graphics. Another thing you can do
is the "make 'em big trick" as described here:
http://www.dfanning.com/graphics_tips/zfonts.html
HTH,
Mike
|
|
|
Re: How to make higher resolution GIF or JPEG image? [message #38061 is a reply to message #38060] |
Fri, 13 February 2004 14:03   |
Andrew Loughe
Messages: 9 Registered: October 1998
|
Junior Member |
|
|
Lawrence,
How about creating a tiff image, and then converting that to GIF?
Does that look any better?
Or a jpeg with quality=100.
Or is this approach like getting water out of a rock?
-Andy
Lawrence Bleau wrote:
> I am running IDL V5.4 on OpenVMS AXP V7.1-2. I cannot upgrade to a
> later version of IDL since it is no longer made for VMS (dumb move,
> but that's another thread). In fact, since IDL V5.4 doesn't generate
> GIF files, I may have to go back to an earlier version to get that
> capability. But I'm getting ahead of myself.
>
> I want to generate a GIF file with a raster-like plot in it. I know
> how to do this using the Z-buffer as a device (SET_PLOT,'Z'). All my
> experience with GIF plots on other systems, though, show they display
> with slightly jagged lines, as though made on a low-res plot (which
> GIF is, I suppose). I have seen, however, GIF plots made by other
> packages that have a great look: smooth curves and letters, no
> jaggies.
>
> I know how to vary the size of the output GIF file: the SET_RESOLUTION
> keyword to the DEVICE command. The problem is that this keyword only
> changes the *size* of the resultant GIF file, not its resolution. If
> I use this keyword, all I get is a large GIF file with jaggies. When
> viewed on a browser, that gives me a larger image. I want the image to
> stay the size that can be displayed on a normal browser window, just
> to have a higher resolution.
>
> Does anyone know of an IDL solution that'd work in V5.4?
>
> If there's none, I can create an alternate format, such as PostScript,
> that has the high resolution plots. I'd then have to convert it to
> GIF (simply because very few browsers, if any, interpret PS).
>
> Does anyone know of a way to convert PS to GIF? I read about
> Ghostscript and Ghostview, but the ftp site says they removed the GIF
> generation capabilities from the package due to licensing problems.
> Since we're going to be displaying these gif's on the web, that's
> probably not a way for us to go. Any other ideas?
>
> Lastly, a suggestion made here was to generate jpeg files instead of
> GIFs. Several questions here:
>
> 1) Is this technically a good way to go, since we're displaying line
> plots rather than pictures? I.e., could the "lossy" nature of jpeg's
> algorithm hurt my plot?
> 2) Since making jpeg's from IDL also involves the Z-buffer device,
> won't this have the same limitations as making a GIF file?
>
> For example of jpeg's with jaggies, see
> http://uleis.umd.edu/~bleau/x.jpg <-- default resolution
> http://uleis.umd.edu/~bleau/x2.jpg <-- used SET_RESOLUTION=[1000,1500]
>
> In particular, take a look at the characters used to label the axes.
> Even at higher resolution they look bad. And yes, I know jaggies are
> usually an artifact of the monitor. Only thing is, I've seen a GIF
> display on a monitor that *didn't* have jaggies, so I know it's
> possible.
>
> Thanks, all.
>
> Lawrence Bleau
> University of Maryland
> Physics Dept., Space Physics Group
> 301-405-6223
> bleau@umtof.umd.edu
--
----> please remove the word OMIT from the return address <----
|
|
|
Re: How to make higher resolution GIF or JPEG image? [message #38118 is a reply to message #38021] |
Tue, 17 February 2004 13:02  |
Michael Wallace
Messages: 409 Registered: December 2003
|
Senior Member |
|
|
>> You can use PNG instead of GIF. PNG is basically a free replacement for
>> GIF. It's been supported in IDL for a while and nearly everyone who I
>> work with who use to use GIFs now use PNGs. I wouldn't recommend JPEG
>> or any other lossy format. And PNGs can be seen without problem in web
>> browsers.
>
>
> That's the concern here: That many folks have web browsers that haven't
> been upgraded in a while and won't be able to support PNG. I counselled
> against using JPEG, but there's not many alternatives if one rules out PNG.
Well, as far as PNGs go, most browsers do support the format and have
for a few years now. I think there was some quirkiness with Internet
Explorer 4 and 5. I'm not sure if the issues with transparency got
fixed in IE 5.5 or 6. Anyway, even the older versions of IE should
support PNGs that don't have transparency. I'm not sure about IE 4, but
I know that IE 5.0 supports them.
Netscape has supported PNG since the early 4.x releases and Mozilla and
Opera always have. I haven't had any users complain about the PNGs on
my sites and some of them do use old software.
Mike
|
|
|