How To Display Png Image In Html Using Perl
2
1
Entering edit mode
12.9 years ago
Rajesh ▴ 30

Hello everyone,

I want to display png image in html but the output is in binary format somthing like below

‰PNG

���
IHDR��Ð���P���¦²_��=PLTEÿQ�Í…?.‹WkŽ#ðÿððæŒK�‚�ÿÿ2ÿ��ÿÿŒ�ÿ¥�HÑÌÒiêÿ�ÿäµúë×õõõ€€€€���¿ÿ€�
€ÿäáH=‹ÿëÍF‚´ÿÿ�ÿê�™2̸†úðæGÿ�@àÐÿõîÿÚ¹/OOÿÖ�™ÿ�úúÒ�ÿÿÌÿ�Uk/eÿ�ú€rÿ�¼àÿÿ=ÿ�­ØæÝ
Ýôÿ�ýõæÿúÍîèªÿ��€€wˆ™ÿ��ÿÞ­øøÿô¤`"‹"�pÛÿ2�fͪÿ¶Áÿe�ÜÜÜ�‹‹Ç…Ò´Œ€€€°ÄÞÿÀËðÿÿÿcGÿ™�ÿ·�jZÍÿÿà
ÿ��d�ÿðõ‡ÎúÓÓÓÿ(�îiiiÿ�ÿÿ„�Qÿ�{hî��Íÿ z‹EÿG�ºUÓÿÌ�ÿ�€�ÿ���€ÚpÖ 
¥**šÍ2ÿÿ�Þ¸‡�ÿ�õÿúÿ�ÿE�Ûp�Žÿ�ÿ�|ü�õÞ³ÿÿð€€�[ÿ�©©©˜û˜zÿ�‹�‹�úšp€Öÿ����é–z�ÿ�ÿ�àÿ�Ú¥
pææú¼��‹�ÎÑAiáÿà�°àæ(ÿ�Š+âÿô�_ž ­ÿ�Ø¿Ø ²ªÿïÕÜ<ÀÀÀ­ÿ/ÿz�‡Îë¯îî£ÿ�ÿ­�‹��ÿÿÿ R-d•íÿ=�ÿ
£�ÿ[�½·kÿ�î‚îÿPpÿ�ð€€õõÜ„ÿ�Í\\ÿúðÁÿ�ÿøÜÿäÄÿi´ÿ×���ÿ·ÿ�”�ÓÿÁ�²""2Í2ÿŽ�ÿúúÿ�ÿÿp�ðøÿ<
³qÿÔ+LŽŒ��ãIDATxœíÝrã …ae®‘óÌ=ú&Ü53B

Code:

use Bio::Graphics;
use Bio::SeqFeature::Generic;

binmode STDOUT;
print  $panel->png;

Thanks

bioperl perl • 6.4k views
ADD COMMENT
0
Entering edit mode

Closing this as off topic.. the available answers should suffice anyway.

ADD REPLY
0
Entering edit mode

Voting to close this as off topic.. the available answers should suffice anyway.

ADD REPLY
2
Entering edit mode
12.9 years ago

I think you are trying to print the output from your BioPerl script to the STDIO. Instead of printing your output on the terminal / html page, try to print image to a file name defined using STDOUT or forward output file to a .png file.

use something like

perl create_image.pl > foo.png

Now use the file name of image (foo.png) with in your html page. For example:

<img src="foo.png" alt="foo here" />
ADD COMMENT
1
Entering edit mode
12.9 years ago

Rajesh, you can actually create the HTML and PNG in one go, as one HTML file, by embedding the PNG image in the HTML itself, which I think you may be interested in. The details can be found in the, for example, this StackOverflow question, and it basically comes down to a carefully crafted [?] element. Something like this answer:

<img alt="My Image" src="data:image/png;base64,iVBORwA<MoreBase64SringHere>" />

I understood it does not necessarily work in all browsers.

ADD COMMENT

Login before adding your answer.

Traffic: 867 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6