Perl/TK scrolled canvas scale IMAGE function??? 
Author Message
 Perl/TK scrolled canvas scale IMAGE function???

Hi,

How come PHP, ImageMagick, and GD have resize functions and TK doesn't?
When the book said "$CANVAS->SCALE", I figured that it would scale
EVERYTHING on the canvas. Apparently, it does only graphic primitives
like lines, circles and rectangles. :-(

My goal was to have a slider mechanism (scale) which would control the
largeness of the image, just like Photoshop! No Can Do in Tk! Using
PerlMagick, you would have to read the file from disk, resize (I.E
Really SCALE, I.E. RESAMPLE), rewrite to disk, have Tk read the new file
and then show you the scaled image. I use a 1% increment on scales, so I
would have to do this 100 times from max to min. This would take many
minutes with 12 MB TIFF files. Photoshop does it in a fraction of a
second. This approach is far to time consuming for production use.

Are there currently any plans from the Tk gang to add an image_resize().
I don't know what the internal Tk data format is, but with a RAW file,
don't you just look at 2 points to the left, 2 points to the right, fit
a 3rd order polynomial and evaluate it at your point to interpolate
(bicubic). This could be really handy and does'nt seem to be that hard!

What if Tk and PerlMagick used the same internal IMAGE representation
when they read the same graphic file. The problem would vanish.

    Brian



Sun, 01 Aug 2004 00:14:32 GMT  
 Perl/TK scrolled canvas scale IMAGE function???

Quote:
> Hi,

> How come PHP, ImageMagick, and GD have resize functions and TK
> doesn't?

You are comparing apples and eggs. Tk is a GUI system while the others
are image manipulation packages (I assume if you refer to PHP, you
mean PHP's GD support or similar).

Quote:
> When the book said "$CANVAS->SCALE", I figured that it would scale
> EVERYTHING on the canvas. Apparently, it does only graphic primitives
> like lines, circles and rectangles. :-(

> My goal was to have a slider mechanism (scale) which would control the
> largeness of the image, just like Photoshop! No Can Do in Tk! Using
> PerlMagick, you would have to read the file from disk, resize (I.E
> Really SCALE, I.E. RESAMPLE), rewrite to disk, have Tk read the new file
> and then show you the scaled image. I use a 1% increment on scales, so I
> would have to do this 100 times from max to min. This would take many
> minutes with 12 MB TIFF files. Photoshop does it in a fraction of a
> second. This approach is far to time consuming for production use.

> Are there currently any plans from the Tk gang to add an image_resize().
> I don't know what the internal Tk data format is, but with a RAW file,
> don't you just look at 2 points to the left, 2 points to the right, fit
> a 3rd order polynomial and evaluate it at your point to interpolate
> (bicubic). This could be really handy and does'nt seem to be that hard!

> What if Tk and PerlMagick used the same internal IMAGE representation
> when they read the same graphic file. The problem would vanish.

My observation is that ImageMagick is very slow and memory consuming
(but on the other hand, the results are superb). I think you should go
with GD. With GD, you can do everything in memory without temporary
files.

Regards,
        Slaven

--

    BBBike - route planner for cyclists in Berlin
    WWW version:     http://www.bbbike.de
    Perl/Tk version: http://bbbike.sourceforge.net



Sun, 01 Aug 2004 05:19:14 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Perl/TK scrolled canvas scale zoom NOOP?

2. Canvas->Scale and Tk::Scale conflict?

3. how to have canvas scale NOT scroll

4. Tk::Canvas scale question

5. perl/tk canvas, scrolled

6. Tk Newbie need Tk strategy help for updating image in canvas

7. Tk Newbie need Tk strategy help for updating image in canvas

8. Any way to export a Perl/Tk Canvas to an image file

9. tying a widget in one canvas to the scrolling of another canvas

10. Draw on image, similar to Tk::Canvas?

11. Displaying GIF images in Tk::Canvas

12. TK, canvases and images

 

 
Powered by phpBB® Forum Software