New topic: Picture.Open returns NIL
<http://forums.realsoftware.com/viewtopic.php?t=40257> Page 1 of 1 [ 11 posts ] Previous topic | Next topic Author Message DaveS Post subject: Picture.Open returns NILPosted: Sat Aug 13, 2011 10:05 am Joined: Sun Aug 05, 2007 10:46 am Posts: 3166 Location: San Diego, CA Code:p_inp=picture.Open(f) First off.. yes.... F is NOT NIL, F.EXIST is TRUE, F does point to a JPG image file. OSX Preview opens and displays the file with no problem. This is withn a Photo manipulation program I am working on.... here is the series of events that led to this 1) Opened the file (yes it loaded it just fine) 2) Rotated the photo 90 degrees 3) Saved the photo back to the same file location 4) loaded the photo again (calling the SAME procedure as in #1) 5) RealStudio returns NIL (no error messages.... and as mentioned the folderitem is NOT NIL, and EXISTS ...) Double click in Finder... Preview pops the file right up Tested in RS2009v5.1 and RS2011v2 _________________ Dave Sisemore MacPro, OSX 10.6.4 RB2009r5.1 Note : I am not interested in any solutions that involve custom Plug-ins of any kind Top guykuo Post subject: Re: Picture.Open returns NILPosted: Sat Aug 13, 2011 10:15 am Joined: Mon Apr 02, 2007 5:51 pm Posts: 363 Location: Cosalient EHR in Washington Thoughts.... 1. Is the picture format being written out one that RS can natively read? 2. Could the folderitem being written out possibly not yet exist when the ensuing open/read happens? _________________ RS 2011r2 OSX 10.7 Win7 XP Top DaveS Post subject: Re: Picture.Open returns NILPosted: Sat Aug 13, 2011 10:18 am Joined: Sun Aug 05, 2007 10:46 am Posts: 3166 Location: San Diego, CA 1... JPG.... and it was read in STEP 1, and not in step 4... plus invalid formats raise an exception.... no exceptions are being raised.... plus PREVIEW works, and says it is a valid JPG file 2... it is being written right back to where it had been..... and this process works 99.9% of the time... plus I have even restarted the app and tried to load the same file... same result I have opened this same image file with 1/2 dozen other OSX apps.. with no problem..... it is only RealStudio that returns a NIL and no errors. AND... if I have one of those apps resave the picture.... RS can read it again.. _________________ Dave Sisemore MacPro, OSX 10.6.4 RB2009r5.1 Note : I am not interested in any solutions that involve custom Plug-ins of any kind Last edited by DaveS on Sat Aug 13, 2011 10:24 am, edited 1 time in total. Top guykuo Post subject: Re: Picture.Open returns NILPosted: Sat Aug 13, 2011 10:23 am Joined: Mon Apr 02, 2007 5:51 pm Posts: 363 Location: Cosalient EHR in Washington So, you are saying this is happening rarely on some images but not all? I'd really suspect the jpeg being written actually is corrupted, but not enough that Preview is complaining. Can you try changing the compression factor to see if that alters the frequency of the problem? _________________ RS 2011r2 OSX 10.7 Win7 XP Top DaveS Post subject: Re: Picture.Open returns NILPosted: Sat Aug 13, 2011 10:27 am Joined: Sun Aug 05, 2007 10:46 am Posts: 3166 Location: San Diego, CA I am trying to find a 100% reproducable series of events.... The problem is... I don't want to alter the picture just to make it viable..... This is a higher end photo manipulator.... so I don't want to add things or take things away from the photo as a band-aid. But let me see if I can find something that always makes this happen _________________ Dave Sisemore MacPro, OSX 10.6.4 RB2009r5.1 Note : I am not interested in any solutions that involve custom Plug-ins of any kind Top guykuo Post subject: Re: Picture.Open returns NILPosted: Sat Aug 13, 2011 12:19 pm Joined: Mon Apr 02, 2007 5:51 pm Posts: 363 Location: Cosalient EHR in Washington I was suggesting changing the compression merely as a temporary debugging step. That would change the way the file is being created by the jpeg writing routine and possibly sidestep the issue. If you see that fix the problem with being able to open the files, then it would implicate the jpeg writing method as the culprit. The other way to investigate would be to simply drop in a different jpeg writing plugin, but I see you are anti-plugins. _________________ RS 2011r2 OSX 10.7 Win7 XP Top DaveS Post subject: Re: Picture.Open returns NILPosted: Sat Aug 13, 2011 12:30 pm Joined: Sun Aug 05, 2007 10:46 am Posts: 3166 Location: San Diego, CA my biggest problem is trying to duplicate the problem on demand.... which so far I have not been able to do.... Plus I do not know that it is specific to JPEG.... it so happens that was the format of the last image involved... _________________ Dave Sisemore MacPro, OSX 10.6.4 RB2009r5.1 Note : I am not interested in any solutions that involve custom Plug-ins of any kind Top guykuo Post subject: Re: Picture.Open returns NILPosted: Sat Aug 13, 2011 12:36 pm Joined: Mon Apr 02, 2007 5:51 pm Posts: 363 Location: Cosalient EHR in Washington Might not be a jpeg problem at all, but that is an avenue to explore. When you say getting nil, are you getting at when you openasPicture or at a subsequent operation on the picture? _________________ RS 2011r2 OSX 10.7 Win7 XP Top DaveS Post subject: Re: Picture.Open returns NILPosted: Sat Aug 13, 2011 1:07 pm Joined: Sun Aug 05, 2007 10:46 am Posts: 3166 Location: San Diego, CA open as picture just like shown in first post. RealStudio returns a NIL.... no errors, no exceptions... just a nice quiet NIL.. But any other OSX application opens it just fine. and also stated.. I cannot reproduce it on demand... so I cannot localize something specific about the image. _________________ Dave Sisemore MacPro, OSX 10.6.4 RB2009r5.1 Note : I am not interested in any solutions that involve custom Plug-ins of any kind Top guykuo Post subject: Re: Picture.Open returns NILPosted: Sat Aug 13, 2011 1:32 pm Joined: Mon Apr 02, 2007 5:51 pm Posts: 363 Location: Cosalient EHR in Washington Tougher when you cannot replicate the bad action. However, you DO have a known bad resultant image file, right? I'd be happy to read a "bad" image into my version of RS and OSX to see if that makes any difference. Also, I suspect you are writing the new image atop the old file. Could the modified file have leftover material from its original state? Maybe something beyond the end of the new data that makes the total file size wrong? What about a save to temp, randomized file name, delete old file, then rename temp file to old name instead of a direct replace? That would at least eliminate any file system latency and old file content chaff questions. You would only be left with a bad jpeg writer or a bad picture importer to sort out. _________________ RS 2011r2 OSX 10.7 Win7 XP Top DaveS Post subject: Re: Picture.Open returns NILPosted: Sat Aug 13, 2011 2:37 pm Joined: Sun Aug 05, 2007 10:46 am Posts: 3166 Location: San Diego, CA Unforturnatly.... I had Previewer re-save the bad image... before thinking about trying to make a copy and see if the copy was bad as well... so as of right now I don't have a bad image to play with... _________________ Dave Sisemore MacPro, OSX 10.6.4 RB2009r5.1 Note : I am not interested in any solutions that involve custom Plug-ins of any kind Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 11 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
