Computer Science Canada Illegal picture ID number 0 |
Author: | ayubelwhishi [ Tue Apr 22, 2014 9:48 am ] | ||
Post subject: | Illegal picture ID number 0 | ||
After trying to fix this for days now, I've finally decided to post the problem here. I'm doing a turing school project and I'm trying to load up images for the project except they keep coming up with Illegal picture ID number 0 "(probable cause: picture was not successfully loaded)" even though I've quadruple checked the path. The name is correct, it is in the same file as the program, the picture is in the correct format (I tried changing them to .jpeg and .bmp but still no success). I'm hoping one of you guys might be able to help with the problem.
|
Author: | Raknarg [ Tue Apr 22, 2014 10:13 am ] |
Post subject: | RE:Illegal picture ID number 0 |
a lot of these pictures seem very poorly named. You're sure they're all spelled perfectly? Also, this one worries me: "HDR-haunted-bed-in-a-haunted-room-in-a-haunted-hospital-in-a-haunted-city-in-a-.....well-you-get-the-idea.jpg" |
Author: | evildaddy911 [ Tue Apr 22, 2014 2:37 pm ] |
Post subject: | RE:Illegal picture ID number 0 |
when the program crashes, it should highlight a line. which line is highlighted? which picture variable is causing the problem? |
Author: | ayubelwhishi [ Wed Apr 23, 2014 8:48 am ] | ||
Post subject: | Re: RE:Illegal picture ID number 0 | ||
Raknarg @ Tue Apr 22, 2014 10:13 am wrote: a lot of these pictures seem very poorly named. You're sure they're all spelled perfectly?
Also, this one worries me: "HDR-haunted-bed-in-a-haunted-room-in-a-haunted-hospital-in-a-haunted-city-in-a-.....well-you-get-the-idea.jpg" I'm copy and paste sure. evildaddy911 wrote: when the program crashes, it should highlight a line. which line is highlighted? which picture variable is causing the problem? It's this one that always highlights and the one I'm trying to fix.
|
Author: | evildaddy911 [ Thu Apr 24, 2014 8:40 pm ] |
Post subject: | RE:Illegal picture ID number 0 |
oh whoops, i didnt notice those last 2 lines, i had assumed you were only posting part of your code. okay, so try (temporarily) replacing that line with Pic.Draw (asylum_hall1, 0, 0, 0) then Pic.Draw (asylum_kitchen, 0, 0, 0), and so on, testing each picture. do all the pictures give the same error? |
Author: | Raknarg [ Thu Apr 24, 2014 8:50 pm ] |
Post subject: | RE:Illegal picture ID number 0 |
Try replacing the last 0 with picCopy. i doubt it will change the error but it is worth a shot. The last argument in Pic.Draw function is an integer telling the function how to handle drawing the picture. There are four preset numbers which are picCopy, picXor, picMerge, picUnderMerge. You have to use one of them. picCopy is most likely the number you actually want to use. |
Author: | Insectoid [ Thu Apr 24, 2014 9:12 pm ] | ||
Post subject: | RE:Illegal picture ID number 0 | ||
Try running this Raknarg. 0 is a perfectly acceptable argument. |
Author: | Raknarg [ Thu Apr 24, 2014 9:22 pm ] |
Post subject: | RE:Illegal picture ID number 0 |
Huh. Didn't bother to check it. I figured it wouldn't doing anything considering the error message... Thanks Insectoid The only other advice I can give given the info here is try changing the image type. A long time ago when I was using Turing, for some reason bmp's worked but all jpeg's did not. If at the end if you can't figure out what the problem is, you can try that. |
Author: | evildaddy911 [ Fri Apr 25, 2014 2:49 pm ] |
Post subject: | RE:Illegal picture ID number 0 |
i had a similar problem to raknarg's the first time i tried to use picture graphics, but the problem was i was trying to use .pngs (because it was either fireworks or MSPaint and i didnt understand exporting). thing is, turing doesnt support that format. so thinking i was being clever, i renamed them from "bar.png" and "foo.png" to "foo.bmp" and "bar.bmp". that didnt work at all, because the extension is there to tell the computer how to interpret the 1s and 0s (its like giving somebody a letter written in morse code and telling them its a picture if they stand far enough away. amusing, but they wont be able to understand the message) Anyways, to save you from wasting several hours trying to figure it out, open your .jpg in an editor and export as .bmp or vice versa |
Author: | ayubelwhishi [ Tue Apr 29, 2014 8:54 am ] |
Post subject: | RE:Illegal picture ID number 0 |
evildaddy911 fixed the problem. Thanks so much man. |
Author: | ylcc23 [ Thu Dec 04, 2014 10:59 pm ] | ||||
Post subject: | RE:Illegal picture ID number 0 | ||||
I'm having a problem fairly similar to ragnar's problem, and this is my first time using graphics. I'm attempting to put in a picture of a friend of mine just cause I'm bored and feel like screwing around a little. Every time I try to load the image, I get one of two errors. Either: Illegal picture ID number "0" (probable cause: picture was not successfully loaded) or Illegal extended character in string literal. I've tried evildaddy911's solution of exporting my jpg to a bmp and I'm still getting the same error.
The picture is in the same dir as the program, and the file name is spelled correctly. |
Author: | Zren [ Thu Dec 04, 2014 11:11 pm ] | ||
Post subject: | RE:Illegal picture ID number 0 | ||
That's because when creating strings, the backslash character is used in combination with another character following it to represent characters that are harder to represent with a single glyph. Example: \n to represent a newline (what you insert when pressing the Enter key). \t to represent the a tabbed indent. \\ to represent a literal backslash character \ http://compsci.ca/holtsoft/doc/explicitstringconstant.html Since backslashes are a common occurance in Windows filepaths, you'll need to get used to escape characters when using strings to represent them. Eg:
|