raspberrypi / pico-playground

BSD 3-Clause "New" or "Revised" License
438 stars 92 forks source link

convert images for sprite_demo #25

Open TheLegendOfKitty opened 2 years ago

TheLegendOfKitty commented 2 years ago

I've tried multiple combinations with different bgar5515 converters (including the packtiles script) but all of them don't render properly (draws only 1 line, some lines are skipped). I'll provide images if anyone wants them. What is the proper way to convert images?

lurch commented 2 years ago

Duplicate of #16 ?

TheLegendOfKitty commented 2 years ago

Seems like OP fixed it, but didn't provide much detail on how. I tried the script he mentioned and did not have any luck.

zachlindsey commented 1 year ago

Just in case anyone else finds this, here are some tips if you want to use the packfiles script:

  1. Make sure your image is the right size. For sprite_demo, make it 128x128 OR edit the berry[i].log_size = 7 line to be whatever power of 2 you want your images to be.
  2. If your image has transparency, use python packtiles.py -sdmf bgar5515 INPUT.png OUTPUT.h. Note the .h on the output. The flags are important: s makes a single image, and m adds transparency metadata. If your image does NOT have transparency, remove the m flag. d is not so important but makes your image look nice.
  3. If your image does NOT have transparency, you need to change berry[i].has_opacity_metadata = false;. Otherwise, the code will read part of your image as a mask. :)
  4. Edit the produced .h file to have the name you want and edit the imports in the main file.

Good luck!