Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Damaged pictures make my project crash



John,

You should be able to use iMagine Photo to determine if an image file is damaged or not.

set imageFile to choose file with prompt "Choose an image file: "
<x-tad-bigger>tell</x-tad-bigger><x-tad-bigger> </x-tad-bigger><x-tad-bigger>application</x-tad-bigger><x-tad-bigger> "iMagine Photo"
  </x-tad-bigger><x-tad-bigger>set</x-tad-bigger><x-tad-bigger> </x-tad-bigger><x-tad-bigger>thisImporter</x-tad-bigger><x-tad-bigger> </x-tad-bigger><x-tad-bigger>to</x-tad-bigger><x-tad-bigger> </x-tad-bigger><x-tad-bigger>import graphic </x-tad-bigger><x-tad-bigger>imageFile
set theProps to the properties of thisImporter
set theErr to the component error of thisImporter
close thisImporter</x-tad-bigger>
<x-tad-bigger>
</x-tad-bigger><x-tad-bigger>end</x-tad-bigger><x-tad-bigger> </x-tad-bigger><x-tad-bigger>tell

</x-tad-bigger>
The component error is also included as one of the properties returned into variable theProps. And is likely to return an error code if the image file is damaged. However the component error is determined before the other properties are obtained and if an error occurs while trying to get the other properties then getting the component error after getting the properties is a more sensitive indication that the image file is damaged.

The component error is sticky, once it is set it stays set, and most commands will return unexpected data. The component error can be set to 0 to clear the error but it would be unusual that you would do this as it usually indicates an error that you can't recover from. Whether the component error has been set or not you always need to close the graphic importer.

iMagine Photo is free, it can be configured to run as a background only application, and I would be more than happy to see iMagine Photo included in an AppleScript Studio application package.

You can do a lot of other things with iMagine Photo for processing image files, so you might find it useful for other parts of your AppleScript studio application as well.

To download click here: http://www.yvs.eu.com/downloads/iMaginePhoto.dmg

To view the on-line documentation, you can start here:

http://www.yvs.eu.com/documentation/

Kevin

On 8 Mar 2005, at 10:38, Novice Software wrote:

I am working on a project that reads and displays images in Applescript Studio.
There can be damaged images that display nothing, that's OK as long as it continues.
but it is also possible that a damaged image makes my program crash.
I am looking for a way to prevent this. Something like a test if the image is OK to process.
A try block is not enough, it won't give an error. I need same sort of event.
Is there any way to test an image-file if it can be processed? in other words:
Can I prevent my project from crashing because of a damaged image-file ?

Thanks,

John
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden

References: 
 >Damaged pictures make my project crash (From: Novice Software <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.