473,472 Members | 2,264 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to fix if-elif-else syntax error?

8 New Member
hi
the problem is a syntax error that highlights pink the "elif" in the program just that. this code is to water mark picture "test.jpg" with the water mark of "model.jpg" with a mark on a white background the cod is:
Expand|Select|Wrap|Line Numbers
  1. import Image,math
  2. model = Image.open("model.jpg")
  3. test = Image.open("test.jpg")
  4. x=test.size[0]
  5. y=test.size[1]
  6. im  = Image.new("RGB",(x,y))
  7.  
  8. for i in range(300):
  9.  for j in range(300):
  10.  
  11.   rpixel,gpixel,bpixel=test.getpixel((i,j))
  12.   rmodel,gmodel,bmodel=model.getpixel((i,j))
  13.  
  14.   if 255==rmodel and 255==gmodel and 255==bmodel:
  15.    im.putpixel((i,j),(rpixel,gpixel,bpixel)
  16.   elif rmodel!=255 or gmodel!=255 or bmodel!=255:
  17.    rrr=int((1.2*rpixel-45))
  18.    ggg=int((1.2*gpixel-45))
  19.    bbb=int((1.2*bpixel-45))
  20.    im.putpixel((i,j),(rrr,ggg,bbb)     
  21.  
  22. im.save('end.bmp')
  23. im.show() 
  24.  
Feb 8 '11 #1
2 3511
bvdet
2,851 Recognized Expert Moderator Specialist
That error often indicates a missing closing parenthesis. A missing closing parenthesis is causing your error.
Feb 8 '11 #2
Oralloy
988 Recognized Expert Contributor
lines 15 and 20 need closing parentheses.

Cheers!
Oralloy
Feb 8 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Andy Levy | last post by:
Hi Im trying to create a function that tests if a 'Username' exists in a particular table. If the value is found then the code generates 'Username1' as the username, and check if that username...
4
by: Randell D. | last post by:
Folks, I test if my PHP should process form data by checking if $_POST is an array - However I always find its condition proves true - Why or alternatvily, what other method can one use to check...
3
by: Smriti Dev | last post by:
Hi there, I have the following code: echo "\n <address>"; if ($entry_info and $entry_info != '') { echo "\n ".stripslashes($entry_info).".,"; } if ($entry_info and $entry_info != '' ) {...
3
by: Eric Linders | last post by:
Hello, We have a form that is collecting user input. There are three fields for each phone number (area code, prefix and suffix). I'm trying to use a simple if statement to confirm if the first...
5
by: Lars Plessmann | last post by:
I have a problem with typecast methods. Here is a setter of an object: function setKind($kind) { if (is_int((int)$kind) and (strlen($kind)<=6)) { $this->kind = $kind; return true;
4
by: Tristan | last post by:
Is there any support for a negative condition in If statements in PHP. Some tutorials ive found say that you can use the if!(condition)cmd; syntax. however i always get an error when i use that....
5
by: Jack | last post by:
I'm setting up a form and want to check if some conditions are met when the form submits. If they aren't, the form displays a missing field message and the user has to go back to fill in the...
32
by: Nuno Paquete | last post by:
Hi group. I'm using this code to see if is there any parameter for variable "menu": if($_GET == "downloads") .... But this code log errors if there is no parameter passed (this heappens at...
4
by: Maxim Vexler | last post by:
if ((($value1 != null) || ($value1 != "")) && $value2 != "" && $value1 != $value2) { ret false } if i omit the i would still get the same result, right? because I check if value1 != "" and then...
4
by: lawrence | last post by:
Google can't find me a good example of how to use the "if exists" syntax in MySql. Is it right that to use it this way: INSERT INTO IF EXISTS tMyTable VALUES("xxlk", "lkjlkjlkjljk") I want...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.