Mentioned below "resize_image" uses nearest-neighbor
sampling, also described in
   http://www.jsoftware.com/jwiki/Scripts/Zoom_View

It is fast, which is good for interactive but 
approximate applications. However, for long-lasting
quality images it is highly unacceptable due to
noticible distortion. You can simply tell by looking
at the result that it was produced by nearest-neighbor.

A better result for down-sampling would be a weighted
average approach, such as linear interpolation. This is
fine for smooth natural photographs.

However, for precision down-sampling, such as making 
smaller screenshots so that features are preserved,
like font is readable, better algorithms exist. For
many J Wiki screenshots, the Lanczos resampling was used,

  http://www.jsoftware.com/jwiki/EditingGuidelines/Images

which uses a bell-shaped kernel with wavy rims--similar
to what Sony was showcasing for its camera/camcoder image
processors.

However, I don't know if those exist in J.


--- Cliff Reiter <[EMAIL PROTECTED]> wrote:

> Hi all,
> Sorry my head has been in the sand -- last semester was brutal.
> This will be fine, but I am in the last frantic weeks of finishing an
> Adirondack hiking book (using lots of good J to overlay GPS info
> on topo maps etc) and so didn't catch this thread sooner.
> 
> It does sound like image3 was really developed to solve tasks
> like the image resizing mentioned. Indeed, automatically creating web 
> scaled picture galleries was the first main application.
> Bicubic is more suited to scaling up (vs down) -- say a poster
> oversized print that might become pixelated otherwise.
> A sample web sized gallery from the image3 stuff:
> http://ww2.lafayette.edu/~reiterc/hikes/misc/2008_01_jt/index.html
> 
> Anyway, resize_image from there should suit the need mentioned,
> but let me say more.
> 
> To read a file, resize, work with than save, consider
> 
>     load '~addons/media/image3/prevare.ijs'
>     fn=:'c:\i\2007\11_hike\pict5353.jpg'
>     $b=:read_image fn
> 3264 2448 3
>     $(1024 1024 resize_image b)
> 1024 768 3
> 
>     fo=:'c:/temp/temp.jpg'
>     (1024 1024 resize_image b)write_image fo
> 195918
> 
>     resize_image
> +-+-+-------------------------------------+
> |4|:|szi=.2{.$y                           |
> | | |szo=.<.szi*<./(|.x)%szi              |
> | | |ind=.(<"0 szi%szo) <[EMAIL PROTECTED]&.> <@i."0 szo|
> | | |(<ind){y                             |
> +-+-+-------------------------------------+
> 
> The 1024 1024 gives a width height window into which it will fit
> the image, respecting the aspect ratio of the original.
> 
> To do the same thing, file to file:
> 
>     1024 1024 mk_th_image fn;fo
> 195918
> 
> To do an entire directory of images, or subset, consider using prevare:
> 
>     prevare images_in 'c:\i\2007\11_hike\'
> 
> Then use "list"-"Full list to group" menu to select all images,
> and then select the window size you want with the "web"-"set web size"
> menu. Then click the "web html group" button and it will create
> web sized versions of all the images in a subdirectory (you will
> be prompted for where, but subdirectory of the first image named 'www'
> is the default location. In fact, a bit more -- it will also create
> thumbnails and an html index showing the thumbnails with clickable links 
> to the new images.
> 
> Hope you find this useful.
> Best,
> Cliff
> 
> 
> Brian Schott wrote:
> > Ric,
> > 
> >     I have used Reiters' fine software and aware of the
> > rescaling afforded by it. It is a little difficult for me to
> > extract that single routine from the script suite, so I
> > thought I would rework the idea for my needs.
> > 
> >     I am not familiar with bicubic algorithms and will
> > look into the link you supplied. Thanks very much.
> > 
> > (B=)
> > 
> > On Mon, 4 Feb 2008, Sherlock, Ric wrote:
> > 
> > + ---Brian Schott wrote:
> > + > I want to rescale
> > + > photos that start at about 2000x3000 pixels, to about 1r3
> > + > ratio. So approximately 667r2000 would likely give an even
> > + > distribution. eg:
> > + >
> > +
> > + Maybe you'd be better coding/using one of the image-resampling
> > + algorithms - bicubic is supposed to be pretty good I think, maybe
> > + someone has one in implemented in J?
> > +
> > + Also, I think there is an image resizing/rescaling verb in Cliff
> > + Reiter's image3 addon in JAL.
> > +
> > + This link give some basic ideas of interpolating images.
> > + http://www.cambridgeincolour.com/tutorials/image-interpolation.htm
> > 
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> > 
> 
> -- 
> Clifford A. Reiter
> Mathematics Department, Lafayette College
> Easton, PA 18042 USA,   610-330-5277
> http://www.lafayette.edu/~reiterc
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 



      
____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to