Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Odd behaviour when using images imported directly to Documents

in Bugs Posts: 735

If I import an image into Codea by copying it directly into the Codea directory via share...Files on the iPad, it shows in the asset picker but doesn't render to screen as a sprite. If I add a second sprite, but this time use the +Photo option in the asset picker, select the photo and name it something different then run, then both the new and original render as the same image. If I comment out the second instance then the first turns black.

Is anyone else seeing this?

Steps to recreate:

  1. Take 2 photos with the iPad
  2. In photo the photo browser select the share button, select both photos and Save to files. Save them to "On my iPad...Codea"
  3. Launch Codea and start a new project
  4. Type Sprite() in draw() and tap the braces to load the asset picker. The newly saved photos should be there. Select one and "use". You may get the NSRange bug - delete the text and replace it with 200,200,200,200 to set the image to a bottom left location sized to 200 by 200
  5. Run - the sprite renders as a black square
  6. Repeat 4 & 5 for the second photo - this time placing it at 500,200,200,200
  7. Run again - both sprites render as black squares
  8. Type Sprite() in draw() for a third time and tap the braces to load the asset picker. This time tap +Photo and select the first photo from the photo library. Set size and location to 200,500,200,200. Give it a brand new name
  9. Run - all three sprites now render as this most recent image
  10. Repeat 8 but load the second image into 500,500,200,200 giving it a different name
  11. Run - three older images render as the first image, the new one renders as it should do.
  12. Comment out the third sprite (from step 8) and run - all 3 images render as the last selected image now
  13. Now additionally comment out the fourth sprite (from step 8) - run - the first two sprites now render black

For context, what I am looking to do is bulk transfer quite a few images across to the directory then iterate through them - going through the +Photo route will be long and laborious!

Comments

  • Posts: 1,272

    @west - you haven't said what image types you have tried, they are usually png or jpg/jpeg files is that the case. Also ensure that they are named with a lower case filetype as that certainly used to clash.

  • Posts: 735

    @Bri_G - thanks for the response - In the example it is whatever is generated by the iPad when it takes a photo (png?). I've separately tried with pngs. The files I'd tried with originally were all numeric file names. Seeing a similar issue with reading from Dropbox

  • Posts: 735

    OK - partially resolved - image that was generated is too large to handle in Codea - able to go via Dropbox now

  • dave1707dave1707 Mod
    edited March 27 Posts: 7,680

    Importing a photo into Codea's Asset folder using +photos, the image is rotated sideways and shows as a black image when shown as a sprite. If I read the image using the image command, it's width and height is 0. This is on my iPad Air.

    If I take a picture with my iPad Pro and import it into Codea using +photos, the picture is orientated correctly and shows OK using sprite. I'm on version 145 on both iPads. The only difference was I didn't try to import any pictures into Codea using Files on the iPad Pro.

  • dave1707dave1707 Mod
    Posts: 7,680

    @Simeon I was playing around with the photos problem reported by @West on my iPad Air and here's an update of what I found.

    If I take a picture in portrait mode and use "+add from photos" to get the picture into the Codea Dropbox folder, the picture shows rotated sideways. If I take a picture in landscape mode, it shows with the correct orientation in the Codea dropbox. If I sprite the first image by itself, it's all black. If I sprite the second image by itself, it shows OK. If I sprite both images at the same time, the first image first, followed by the second image, the second image shows as both images. If I show the second one first, then the first image is black and the second image is OK.

Sign In or Register to comment.