2017-10-04 6 views
0

PrimeFaces 6.1にpng画像を表示するのが難しいです。Primefaces 6.1の黒い背景の画像表示

イメージは、データベースからバイト配列形式でロードされました。 jpgはうまく表示されていますが、pngは常に黒い背景で表示されます。他のすべてのjpg表示適切

public StreamedContent getImage() throws IOException { 
    FacesContext context = FacesContext.getCurrentInstance(); 

    if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) { 
     // So, we're rendering the HTML. Return a stub StreamedContent so that it will generate right URL. 
     return new DefaultStreamedContent(); 
    } 
    else { 
     // So, browser is requesting the image. Return a real StreamedContent with the image bytes. 
     String fileId = context.getExternalContext().getRequestParameterMap().get("fileId"); 
     File file = (File) fileBean.getFileCache().get(fileId); 
     return new ByteArrayContent(file.getThumbnail(),file.getFileType(),file.getFileName()); 
    } 
} 

が、PNG形式の画像は、1私の質問に設定した透明になりますよう

<p:graphicImage value="#{fileControlBean.image}"> 
    <f:param name="fileId" value="#{file.fileId}" /> 
</p:graphicImage> 

とバック豆:

この

は、JSFのために私のコードスニペットを次のとおりです。どのように透明に戻すことができますか?それともバグですか?

答えて

0

申し訳ありませんが、このクエストは正しく尋ねられていません。黒い背景の問題は、透明性の問題があるので、png自己によって引き起こされました。私はinkscapeを使ってpngを再生成します。黒い背景がなくなった。

関連する問題