Hi all,
following Michael's comment I did a test on RasterImageLayer substituting
JAI in
private BufferedImage scaleImage() method and associated ( protected
BufferedImage getScaledImageMatchingVisible()).
This is the method I used:

 private BufferedImage scaleImage(BufferedImage srcImg, int xScale, int
yScale){
        BufferedImage resizedBuf = new BufferedImage(xScale,
yScale,srcImg.getType());
        Graphics2D g2 = resizedBuf.createGraphics();
        g2.drawImage(srcImg, 0, 0, xScale, yScale, null);
        g2.dispose();
        return resizedBuf;
    }

instead of JAI

 protected BufferedImage scaleImage(BufferedImage im, float xScale, float
yScale) {
    System.setProperty("com.sun.media.jai.disableMediaLib", "true");
    ParameterBlock pb = new ParameterBlock();
     pb.addSource(im);
     pb.add(xScale);
     pb.add(yScale);
    return JAI.create("Scale", pb, null).getAsBufferedImage();
    }

I  did a test loading the set of rasters that Roberto provided (26 raster)
and I didn't recognized a difference of
timing to load and display all the raster, not even a difference of RAM
usage: at the end OJ used around 260-270 Mb.
Even the time to redraw single raster seems to be very random (sometimes
JAI is faster other time graphics2D is faster)
Maybe further test are required.
Peppe


Il giorno dom 8 nov 2020 alle ore 13:08 ede via Jump-pilot-devel <
jump-pilot-devel@lists.sourceforge.net> ha scritto:

> the use of JAI operations saves memory afaik. . it ideally creates a chain
> from loading over computing to rendering.
>
> the scaling you mention above seems to use BufferedImage in memory, which
> of course is faster but needs the whole source image in memory. for cases
> like Sextante, where images are currently held in memory anyway this may
> not be a limiting factor so i'm all for the faster solution.
>
> ReferencedImage uses JAI RenderedOP up to rendering the image and *should*
> be therefore able to show bigger source images. never tested though.
>
> ..ede
> ------------------------------
>
> * [bugs:#509] <https://sourceforge.net/p/jump-pilot/bugs/509/> GeoImage
> and RasterImageLayer : why JAI*
>
> *Status:* open
> *Milestone:* OJ_future
> *Created:* Sat Nov 07, 2020 09:12 PM UTC by michael michaud
> *Last Updated:* Sat Nov 07, 2020 09:12 PM UTC
> *Owner:* michael michaud
>
> GeoImage and RasterImageLayer process image using JAI :
> It crops and scales the visible part of the image. See also ticket 507.
> This ticket is about the choice of JAI to rescale the image. Following
> baeldung post https://www.baeldung.com/java-resize-image i tried with awt
> and graphics2D and rescaling seems to be much faster.
> Maybe JAI has a richer api for those who want more complex processing, but
> graphics2D propose several kind of interpolation through the
> RenderingHints, which may be enough.
> To be tested further after the move to github.
> ------------------------------
>
> Sent from sourceforge.net because jump-pilot-devel@lists.sourceforge.net
> is subscribed to https://sourceforge.net/p/jump-pilot/bugs/
>
> To unsubscribe from further messages, a project admin can change settings
> at https://sourceforge.net/p/jump-pilot/admin/bugs/options. Or, if this
> is a mailing list, you can unsubscribe from the mailing list.
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to