[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-1592) <s:graphicImage> should accept raw byte[] without conversion

Marcel Kolsteren (JIRA) jira-events at lists.jboss.org
Sat Sep 5 12:59:23 EDT 2009


    [ https://jira.jboss.org/jira/browse/JBSEAM-1592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12484636#action_12484636 ] 

Marcel Kolsteren commented on JBSEAM-1592:
------------------------------------------

The degrading image quality is a big problem for me as well. For intranet web applications it might be acceptable, but public web sites that are viewed by (potential) customers need to have sharp images.

I found a quick and easy solution for the case where the value is a simple byte[]. The GraphicImageRendererBase (see attachment) detects whether a transformation has taken place. If not, the input byte array is copied to the image store. Otherwise, the transformed image is copied. I tested this patch for JBoss Seam 2.2.0.GA. It should be easy to extend the solution for other types then byte[], but this is a good start. I hope this can be added to a next Seam version.

> <s:graphicImage> should accept raw byte[] without conversion
> ------------------------------------------------------------
>
>                 Key: JBSEAM-1592
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-1592
>             Project: Seam
>          Issue Type: Feature Request
>          Components: JSF Controls
>    Affects Versions: 1.2.1.GA, 1.3.0.ALPHA, 2.0.0.BETA1
>         Environment: latest from repo 
>            Reporter: Gena Batalski
>            Priority: Minor
>         Attachments: GraphicImageRendererBase.java
>
>
> It would be helpful to feed the <s:graphicImage> with raw byte[] (possible also ByteArray - stream) without converting it to BufferedImage or something else. Also the content type could be manually  entered. Of course, its in the responsibility of the developer, to take care about the correctness of input. Optional attributes (forceContentType, forceImage or something else)  could do this job on the UI side.
> Background of the request:
> if i comment out the byte[] handling in Image.class (line 404 method readImage()) as in a following snipplet,  i get an expected quality. Otherwise, the image quality decreases significantly, especially for small images (icons, thumbnails).
>   
>  /*
>             byte[] b = (byte[]) input;
>             readImage(new ByteArrayInputStream(b));
>             */
>        
>             output  = (byte[]) input;
> I also would have some possibility, to prepare the image on demand. Currently i'm using two servlets: one SeamResource and one for my images. My servlet receives an URI and selects an image LOB from DB, because it isn't necessary to store the images in memory (they could be large) and the images could stay unrequested. What i need is some kind callback (converter?) which asks me for byte[] or stream representation of an image uri.
> Thanks
> Gena
>  

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list