473,788 Members | 2,898 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1728
> 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,imag e.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.cro pX) , \
float(image.cro pY) , \
(float(image.cr opX)+float(imag e.cropW)), \
(float(image.cr opY)+float(imag e.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_compress ione = Image.BILINEAR

try:
pil =
pil.resize((ima ge.realW,image. realH),filtro_c ompressione)
except:
traceback.print _exc()
if not pil.mode == 'RGB':
try:

pil = pil.convert('RG B')

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********@yaho o.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
3789
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 product. A marketing/product manager has brought in additional management and "architecture" experts to propose moving the entire thing to a Java (application server) platform for the next release. They want a "scalable, enterprise solution"...
137
7188
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 pragmatic - 3) I usually move forward when I get the gut feeling I am correct - 4) Most likely because of 1), I usually do not manage to fully explain 3) when it comes true. - 5) I have developed for many years (>18) in many different environments,...
1
1270
by: Gunne | last post by:
I have the following xml data available: ----------------------------------------------------------------------- <LinkCategory Name="Hardware" > <Link LinkName="hardwarelink1" LinkUrl="www.msn.com" PlusLink="False"/> <Link LinkName="hardwarelink2" LinkUrl="www.msn.com" PlusLink="True"/> <Link LinkName="hardwarelink3" LinkUrl="www.msn.com" PlusLink="True"/> <Link LinkName="hardwarelink4" LinkUrl="www.msn.com"
3
1182
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 screen of death, but it powers off - When it restarts, (this does not necessarily follow the previous issue), it runs chkdisk and finds all kinds of problems. Now unto the relevance to this group.
1
1765
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 hardware devices simultaneaously. When I run the program on a desktop running Windows 2000 it works fine. When I run it on a Laptop using XP I start having problems. It seems that when the ports are initiated, either one will work but not the
14
4416
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 value (e.g. *pMDMA_S0_START_ADDR = 0x04000;) the compiler give me these 2 warning:
4
3424
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 tell me how t o write a assembler code in c++........ please reply..
4
4346
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 application crashes with the same error message I would get when writing <brand no closing tag. To make everything a little stranger, even <br></brseems to be bad while <lbr/is fine. Ive tried some other tag names and the problem only appears with...
56
3644
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 me this is a joke. It must be a joke....because I also have read that VS2002 and VS2003 will not be supported on Vista. This clearly violates Microsoft's own terms of support for these products.
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10364
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.