473,320 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

PIL problem with biprocessor hardware

Hi guys,

I've a problem, but very big!
So, i have a python/PIL application that manipulate images ( rotate,
crop, save, etc etc ).
If this application work on a PC mono-processor, I don't have any
problems.
If this application work instead on a PC bi-processor, the process
elaborates an image "corrupted":

I mean "corrupted" because:

If I open this image with any image-viewer, it will show the image
with background color on top blue, and on bottom green. Sometimes it
can happen that somethings inside was wrong designed.

If i open this image instead with GIMP, this message will shown:

Corrupt JPEG data: 36 ( this value is not ever equal ) extraneous bytes
before marker 0xd9
EXIF data will be ignored.

This error don't has a procedure that will produce it. It's random.

I've executed this application in a PC mono-processor, and it seems all
ok ( 100% ), instead on a PC bi-processor sometimes don't work ( 90% ?
).

Thx very much

May 26 '06 #1
5 1706
> If this application work on a PC mono-processor, I don't have any
problems.
If this application work instead on a PC bi-processor, the process
elaborates an image "corrupted":


Sounds like you've got some thread synch issue. On a mono-processor
system, your threads are running serially, but on an SMP system (i.e.
bi-processor) your threads are truly running in parellel thru the CPU.
I'd take a good look at any data you're locking currently, or should be
locking. It's hard to make more concrete recommendations without
knowing exactly what the code looks like.

May 26 '06 #2
OK, this is the code:

"""
image is the object instance of Image class which contains all
informations
"""
pil = Image.open( os.path.join( image.path,image.name ) )

if image.rotation_angle != 2:
try:
pil = pil.rotate( rotation_levels[image.rotation_angle]
)
except:
traceback.print_exc()
result = False
if ( image.cropped ):

box = [ float(image.cropX) , \
float(image.cropY) , \
(float(image.cropX)+float(image.cropW)), \
(float(image.cropY)+float(image.cropH))
]

try:
pil = pil.crop( box )
except:
traceback.print_exc()

if pil.size[0] < pil.size[1]:
try:
pil = pil.rotate( 90 )
except:
traceback.print_exc()

filtro_compressione = Image.BILINEAR

try:
pil =
pil.resize((image.realW,image.realH),filtro_compre ssione)
except:
traceback.print_exc()
if not pil.mode == 'RGB':
try:

pil = pil.convert('RGB')

except:

traceback.print_exc()

try:

pil.save( path, format="JPEG", quality=80 )
except Exception,e:
traceback.print_exc()

I think this is very normal.
It's NOT normal that don't work well on PC SMP processor...

not?

May 26 '06 #3
I wonder if there are other threads accessing image? Maybe image isn't
fully initialized by some other thread before this code accesses it?

It's hard to say what's going wrong. I don't believe that an SMP system
would have any bearing on an application unless it uses multiple
threads of execution. I wonder if

May 26 '06 #4
oops. lost my train of thought. I was gonna say, I wonder if some of
these image manipulation routines are using multiple threads?

May 26 '06 #5
da********@yahoo.com wrote:
oops. lost my train of thought. I was gonna say, I wonder if some of
these image manipulation routines are using multiple threads?


PIL doesn't use threading by itself, and I know of quite a few PIL-based
systems running on multi-processor hardware (not to mention multi-core
and hyper-threading systems).

if the posted snippet is all there is, I'd blame it on the hardware ;-)

</F>

May 27 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

44
by: flyingfred0 | last post by:
A small software team (developers, leads and even the manager when he's had time) has been using (wx)Python/PostgreSQL for over 2 years and developed a successful 1.0 release of a client/server...
137
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very...
1
by: Gunne | last post by:
I have the following xml data available: ----------------------------------------------------------------------- <LinkCategory Name="Hardware" > <Link LinkName="hardwarelink1"...
3
by: David Cho | last post by:
After my laptop crapped out, I had to resort to my desktop as a backup. The problems I have experienced are - the computer powers off and restarts without warning. It powers off. Not a blue...
1
by: David | last post by:
I have written an application in VB.NET 2003 that uses the SAX serial component for RS232 communications with hardware. The program sets up 2 serial ports so that it can talk to 2 different...
14
by: mauri1106 | last post by:
Hi, I have a little problem with a pointer. In my project is included an ".h" file with this declaration: "#define pMDMA_D0_START_ADDR ((void * volatile *)MDMA_D0_START_ADDR)" If I assign a...
4
by: prashant | last post by:
Guys does any body know how to develop an micro operating system using c++. or tell about how to make an executable that can interect with system hardware and does not require a ms dos to run.And...
4
by: Christofer Dutz | last post by:
Hi, I am having a small problem, that is driving me nuts. My application reads some Xml and runs 2 Xsl Transformations to generate HTML. As soon as my second XSL introduces some <br/tags, the...
56
by: Squishy | last post by:
I tried installing my VS2005 Pro on Vista Ultimate 32 bit RTM today and got errors stating that VS2005 was not compatible with Vista. Microsoft......please pull your finger out of my ass and tell...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.