Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Perl (http://www.programmingforums.org/forum21.html)
-   -   Can I Use Cgi/Perl to Pile Up Picture? (http://www.programmingforums.org/showthread.php?t=14882)

chicka2chubby Jan 7th, 2008 5:49 AM

Can I Use Cgi/Perl to Pile Up Picture?
 
Dear Viewers,
My English is very bad so please bear with my silly mistake. Im sorry if my words are rude.:'(

I would like to know , can i use cgi/perl to combine @ pile up picture like this link below
http://www.ss.iij4u.or.jp/~somali/we...composite.html

they are using ImageMagick,so i would like to know whether the basic perl/cgi can do the same coding.

:: what i am trying to do for my final year project is, to put a mark ( small circle dot ) on a map to show the location system after we get the latitud & latitude from the data log ::

unfortunately, the mark always do not stay on the right place. :icon_cry:

i hope anybody here could help me. Thank You:icon_redface:

Sane Jan 7th, 2008 9:39 AM

Re: Can I Use Cgi/Perl to Pile Up Picture?
 
Are you using ImageMagick for Perl?

If the mark does not always stay on the right place, you might be using PerlMagick incorrectly. Could you post your code?

If you do not want to use PerlMagick, you could use another image library (if one exists). Sorry. Basic Perl does not let you change images.

chicka2chubby Jan 7th, 2008 10:12 PM

Re: Can I Use Cgi/Perl to Pile Up Picture?
 
this is the code

open FILE, ">>$file"; #ファイルへの書き込み
#flock (FILE, 2);
print (FILE "\"", $tizu);
print (FILE "\"\,\"", $ido);
print (FILE "\"\,\"", $keido);
print (FILE "\"\,\"", $jikan);
print (FILE "\"\,\"", $tate);
print (FILE "\"\,\"", $yoko);
print (FILE "\"\,\"", $wariai);
print (FILE "\"\n");
#flock (FILE, 8);
close FILE;

$view = "${tizu}.jpg";
print "Content-type: image/jpeg\n\n"; #HTMLファイルや画像ファイルは、サーバからデータを送信する際に情*の種類を示す(ブラウザに返すレスポンスの形式を指定)
open(IMG, "$view");
binmode (IMG);
binmode STDOUT;
print <IMG>;


$a = '1.gif';
print "Content-type: image/gif\n\n";
open(IMG, "$a");
binmode (IMG);
binmode STDOUT;
print <IMG>; #
close(IMG);

exit;

thank you for your help :D

Sane Jan 7th, 2008 10:57 PM

Re: Can I Use Cgi/Perl to Pile Up Picture?
 
Oh. You are not using PerlMagick. Will you try it?

Have you considered overlaying the two images in HTML using CSS?

For example, to place the image "some_img.jpg" at coordinates (100, 150) on the website:

:

  1. <img src="some_img.jpg" class="my_mark" />


:

  1. img.my_mark {
  2.     position: absolute;
  3.     left: 100px;
  4.     top: 150px;
  5. }


This may be simpler depending on your requirements.

chicka2chubby Jan 9th, 2008 1:07 AM

Re: Can I Use Cgi/Perl to Pile Up Picture?
 
thanks sane.

i will try to do the overlaying things using CSS.

Can i ask you something,

what is the meaning of binmode ( binary mode ) and how to use it?

im doing this with 2 of my friends and they asked me to find that " can we overlay images using binary mode?" ??

thank you again. sorry

Sane Jan 9th, 2008 12:09 PM

Re: Can I Use Cgi/Perl to Pile Up Picture?
 
binmode only changes the file handler from TEXT mode to BINARY mode. So that when you read/write a file, the file stream knows that it is Binary, and not Text.

Binary mode is necessary if you are reading/writing a file that is not text, such as an image. An image is binary, so you must use binmode to read it. Binmode can not be used to do or "make" anything.

In other words, you can not use binmode to overlay images. If you wrote your own image decoding algorithm to put the pixels together manually, you would need binmode to do that. This is what ImageMagick is meant to do for you. You do not want to rewrite something that complicated, especially if it has already been done for you.

Do not forget about the alternative of using PerlMagick, it may be more stable than relying on the browser to work correctly with CSS.


All times are GMT -5. The time now is 3:41 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC