Watermark top tif only

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
cappsie

Watermark top tif only

Post by cappsie »

Hi,

I thought I'd start a different thread with this question. Can I watermark just the top tif image? I found this thread: viewtopic.php?t=23965 which seems close to what I want to do, only that one suggests cloning, deleting and recreating. Surely that wouldn't be necessary if I only wanted to watermark the top or first-only image?

The tiff could be one image or perhaps as many as 10.

Thoughts?

A.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Watermark top tif only

Post by Bonzo »

Try adding [0] to your tiff file e.g. input.tif[0]
cappsie

Re: Watermark top tif only

Post by cappsie »

I'm not entirely sure where to put the [0] against or after a variable. I keep getting odd errors as if ImageMagick is attempting to read in the first character of the path...

Where would you put it in this line (if at all in this line): :)

Code: Select all

 $cmd = "$original_image -font C:/Windows/Fonts/ARIAL.TTF -fill rgba(0,0,0,0.5) -pointsize 100 -gravity NorthEast -annotate 0x0+0+0 \"$text_submitted\" -write $output\\$new_image -write $text_submitted.jpg ";

Thanks,
Adam.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Watermark top tif only

Post by Bonzo »

Code: Select all

$original image = 'input.tif[0]';
$cmd = "$original_image -font C:/Windows/Fonts/ARIAL.TTF -fill rgba(0,0,0,0.5) -pointsize 100 -gravity NorthEast -annotate 0x0+0+0 \"$text_submitted\" -write $output\\$new_image -write $text_submitted.jpg ";
cappsie

Re: Watermark top tif only

Post by cappsie »

Bonzo wrote:

Code: Select all

$original image = 'input.tif[0]';
$cmd = "$original_image -font C:/Windows/Fonts/ARIAL.TTF -fill rgba(0,0,0,0.5) -pointsize 100 -gravity NorthEast -annotate 0x0+0+0 \"$text_submitted\" -write $output\\$new_image -write $text_submitted.jpg ";
How can I do that if the $original_image is a variable and not explicitly defined as in your example?

Edit: I should add that my image is defined thus:

Code: Select all

$original_image = $_FILES['filename']['tmp_name'];
A.
cappsie

Re: Watermark top tif only

Post by cappsie »

Hi again,

Right ignore the last one; I'm not going to need it.

The new issue is accepting an input from a dropdown list and adding that to the watermark. I've tried declaring it thus:

Code: Select all

// Cleanup the text.
$text_submitted = clean ( $_POST['text_submitted'], 18 );
$clinic_submitted = clean ( $_POST['clinic_submitted '], 18 );
$staff_submitted = clean ( $_POST['staff_submitted '], 18 );
Then calling it:

Code: Select all

$cmd = "$original_image -font C:/Windows/Fonts/ARIAL.TTF -fill rgba(0,0,0,0.5) -pointsize 100 -gravity NorthEast -annotate 0x0+0+0 \"$text_submitted\\$clinic_submitted\\$staff_submitted\" -write $output\\$text_submitted\"-\"$new_image ";
The HTML form:

Code: Select all

<form method="post" action="<?php echo  $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data">
<label>Select file for grading</label>
<input type="file" name="filename" /><BR /><BR />
<input type="text" name="text_submitted" value="Graded <?php echo date('d-m-Y'); ?>"/>
<select>
  <option value="AUD1S" name="clinic_submitted">AUD1S</option>
  <option value="AUD2L" name="clinic_submitted">AUD2L</option>
  <option value="AUD3A" name="clinic_submitted">AUD3A</option>
  <option value="AUD4M" name="clinic_submitted">AUD4M</option>
  <option value="AUD4A" name="clinic_submitted">AUD4A</option>
  <option value="AUD5M" name="clinic_submitted">AUD5M</option>
  <option value="AUD3B" name="clinic_submitted">AUD3B</option>
  <option value="AUD4B" name="clinic_submitted">AUD4B</option>
  <option value="TIN1M" name="clinic_submitted">TIN1M</option>
  <option value="TIN2B" name="clinic_submitted">TIN2B</option>
</select>
<select>
  <option value="John Smith" name="staff_submitted">John Smith</option>
  <option value="OTHER"  name="staff_submitted">OTHER</option>
</select>
<input type="Submit" name="Submit" value="Grade File" />
<BR /><BR /><BR />
</form>
Any thoughts?

Thanks,
A.
cappsie

Re: Watermark top tif only

Post by cappsie »

No problems, all sorted :D
Post Reply