Showing posts sorted by relevance for query spr2png. Sort by date Show all posts
Showing posts sorted by relevance for query spr2png. Sort by date Show all posts

Wednesday, March 10, 2021

Oneliner to convert them all



fe -nx *.spr "perl ~/DS/SpriteEditor/bin/spr2png.pl %.spr ~/hobby/dspr/demo-%.blk.png --maxheight=256"
fe -nx *.spr "perl ~/DS/SpriteEditor/bin/spr2png.pl 
        %.spr ~/hobby/dspr/demo-%.spr.png
        --extra --maxheight=256"
Another oneliner to gather them all, and in HTML bind them...
(echo '<html><body>' ; 
   fe *.png "echo '<div style=@display: inline-block;
     background: grey; text-align: center;@>
     <img src=@%@ title=@%@ style=@display: block;@>
     <small>%</small></div>'" ;
   echo '</body></html>') 
   |  sed -e "s/@/'/g" > test.html

Why ? Because I need to know which are okay, which need to be recovered and which need post-processing.

And then I realize that I cannot 'compact' the alternate spritesets (draft and animations), and one possible explanation for that is that the 'free tiles' information for that pool is incoherent. Maybe my `sprck` tool could fix that, but to be honest, its output is so cryptic that I might need to run it in DDD to figure out. 

  • horizontal vertical tripes mean there's no pages using the block
  • vertical horizontal stripes mean there's a FREE entry for the block.
  • why is there so many FREE slots indicating that tile#0 is free ? (there's sprck_cleanup() to address that).
  • even after it 'repaired' the file, I seem to still have the same 
  • [done] fix spr2png --cleanup so that it works properly with --extra=1 and --extra=2.
  • [dont] ensure sprck is capable of dropping FREE entries when a block is used on a page. instead, we have to mark them free
  • [okay] ensure sprck can add FREE entries when no page is using a block - that's automatic in -repair mode.
  • [done] have fe and color.pl and whereami hosted in DS/bin (or DS/tools/ or wherever it fits) on Codeberg

Wednesday, June 13, 2012

ghost busting with spr2png.pl

No matter how much I improved SEDS, I still can't "optimize" my spriteset below 1024 tiles without messing up something. So I had to admit a disturbing possibility: maybe my tileset is *really* corrupted, and has been so unnoticed for some times ... maybe I'm suffering the equivalent of infamous cross clusters.

Let's recap: in .spr files, you find BLCK section that provides you the tile number for each block (logical entity) on that page. Then, you'll find one FREE section per "ram type" (block, sprite, streamed animations and drafts) telling you which tiles could be reused because you deleted its content. Good so far... except when they disagree.


Corriger ce spriteset de la school zone s'avère décidément plus complexe que prévu. Après une nouvelle série de corrections apportées à SEDS, toujours pas moyen d'avoir les bonnes images. En tentant de "rétrécir" les images, je me retrouve avec plusieurs sprites qui partagent les même données. Un vrai méli-mélo (in)digne du système de fichier FAT sur lequel tout celà est sauvé.

Permettez que je vous passe les détails techniques: il y a deux marquages des tiles occupés dans un fichier .spr (disons "vertical" et "horizontal"), et là, ils ne sont plus d'accord. Une stupide erreur au moment de sauver les sections 'FREE' des différents types de graphismes.

I already had modified spr2png.pl tool with a --cleanup mode that renders horizontal stripes accross tiles that weren't listed in any BLCK section earlier in the week, and now I've just added vertical stripes on tiles that are listed in the FREE section. We should thus see only solid sprites or 'dotted' tiles. But that's not exactly what happens: instead, I've got quite a lot of sprites with vertical stripes, that are thus supposed to be kept, but that could be erased as soon as I'll start editing new stuff.

My first mission, should I choose to accept it, will be to fix the .spr file so that all tiles stay safe. Then will come the hard stuff. Where in the code is the ghost maker... Have I forgot to adjust free lists when copying things around between spritesets?

Hopefully, not. It seems to be simpler than this: I have 3 FREE sections for the 'sprite' tileset. My bet is that I failed to set the proper spriteram identifier and have all "sprite, draft and streamanims free tiles" applied on the sprite tileset ^^"

Wednesday, September 03, 2008

.spr

Okay. Let's say you've downloaded the latest SEDS version and gave it a try. You loved the pixel art you've drawn and hopefully pressed START + R + A to save them on your media card. Then you either transferred them with runme or simply used a media card reader to retrieve them.

SpriteA.spr at the card's root. Most likely to be your drawings. As a matter, it is.

But what are you going to do now with that .spr file that your file explorer doesn't know and that do not open in Graphics Gale, Photoshop or whatever other spriting program you could think of.

If you are a "power user", you may already have
perl installed or find it not that complicated to install. In that case, you're suggested to install the Image::Imlib2 package as well so that you can run spr2png.pl conversion script directly on your machine and have your sprites converted in a more user-friendly format.

If you're just a regular user, or if you haven't used SEDS often enough to find it is worth that much installation trouble, you still have an escape route: the brand new online conversion tool that can convert your art into a regular .png file with just the help of a regular web browser. Just select the picture with the "browse ..." button, click "post" and wait a couple of seconds to have the script doing the conversion and replying with the picture.

Have Fun ... i also submitted a "job offer" on sourceforge to find someone willing to write a batch conversion tool for Windows ... wait'n'see.


Costz dit : Mais on peu récup les sprites dans un autre format que le tien ?
Je veux dire y a un convertisseur pour que l'on puisse avoir au final une .png ou .gif ?


Oui, tout à fait. Il y a tout d'abord le script spr2png.pl qui, moyennant installation de perl et du module Image::Imlib2, permet de convertir tout ça localement sans soucis.

Et pour ceux qui auraient du mal à installer tout ça sur un Windows (sous linux, c'est juste apt-get install libimage-imlib2-perl), ou qui voudraient tout simplement essayer le sprite editor sans se prendre la tête, j'ai bricolé un convertisseur en ligne: tu uploades ton .spr et tu reçois le .png en échange.

PS: j'ai les sources en Perl du convertisseur et une esquisse du format de données avec le convertisseur en ligne. Je cherche quelqu'un qui connaisse la programmation windows (C, C++, VB, C# : tout est bon) pour écrire un convertisseur "user friendly" pour les wutilisateurs.

Si vous êtes partant, contactez-moi : pype_1999.geo@yahoo.com.

Saturday, August 09, 2008

Petits Pas

vouaip. Petit progrès sur SEDS, qui sait (enfin) effacer ce qui ne vous plaît plus. C'est pas ultra-ergonomique (pressez R pour activer le curseur, déplacez le curseur sur le bloc qui vous déplaît puis pressez X pour l'effacer), mais ça marche.

Il faut dire que pour l'instant, j'essaie au maximum de me concentrer sur un fichu article reprenant mes travaux de thèse pour un journal, et qu'en plus, j'ai du faire une "pause sans écran" pendant une ou deux semaines, mes petits yeux ayant dit "stop, on en peut plus" :-/

Bref, je vais vous laisser vous rendre compte que j'ai pratiquement triplé la taille de mon post précédent (sur l'appleman), uploadé plein d'images et tout, et aller porter le dernier Maliki à ma fée avant que Morpheus ne l'emporte. Moi j'attaque les robots d'Asimov ;)

Enfin, avec tout ça, j'ai enfin réussi à "réparer" mon tileset de forêt et j'en ai profité pour faire un peu le ménage (virer les vieilles pommes et les souches qui ne servaient plus à rien ;) Restera à pouvoir "extraire" les anims et autres sprites, mais ça, ce sera une autre histoire, parce que là, je suis impatient d'essayer d'implémenter les tiles pentus.

*edit*: oh, et j'ai réussi à faire de "spr2png" un convertisseur reconnu par Image Magick. prochaine étape, en faire un vrai type mime reconnu par gnome et les autres ^_^

Monday, May 28, 2012

sponge-hands-and-ink-and-mockup

Here I stand, guilty of doing low-level debugging where the situation wasn't calling it. Now that I have a "test level" for the school zone, it's very tempting to start writing more monster code. I thought I could easily hack a Sponge Bop test while *deline was asleep this afternoon, but for some reason, only the first frame of the animation did show up. The rest was just rubbish: Bilou feets and similar stuff.

Was my data corrupt ? Was there some nasty bug related to 32x32 sprites in the revised game engine (there shouldn't have been?) I scanned virtually everything, but the data I was (painfully) reading in DDD made little sense.

I finally decided to hack some debugging output in my .spr to .png converter to see what "pages" were containing, and I turned suspicious over the following entry:

4x4=1020,1036,1052,1068,1116,1132,1148,1164,1180,1196

1036 ? 1052 ? that's a bit surprising for a sprite number ... when I looked at the shape of the spritesheet, the obvious (finally) hit me: the DS can only enumerate 1024 tiles for sprites. No more, no less. Everything on the fifth column of the spritesheet can be nicely viewed in the SpriteEditor, but cannot be used in games. It's not even the first time I encounter the problem >_<. I think I'll need something in the Sprite Editor that warns the user about this when saving a tileset. And I'll have to figure out how I solved the problem last time...

Oh, and it's been over one year that I'm longing for a "draft" tileset and a "animation" tileset in .spr files ... I think it's now time to add this to Sprite Editor ...

developments:

  • [done] enable up to 4 SpriteRam;
  • [wish] show how much tiles are used in each SpriteRam (other than pressing L+START to enable debugging, I mean), and which spritepage should be moved to compress the tileset.
  • [done] shrink spritea.spr so that it can be fully used by the engine;
  • [next] enable 16x16 <-> 32x32 sheet conversion;
  • [next] find a way to use the ink animation in the level;
  • [done] produce a warning when saving a file where sprites or blocks set has too much tiles;
  • [done] allow hint on which tile is used when producing tilesets with spr2png.pl

regression tests after the edit:
  • [ok] change the spriteram used for a page
  • [ok] save and load file with more than 2 spriterams
  • [---] use the "scan colors" and "color remap function" (actually, nevermind: it operates on the working sheet, not on the SpriteRam itself).
  • [ok] use the "compact tileset" feature (doesn't it just reduce the 'watermark' when last tiles are no longer used ? couldn't that be automated with load/save ?)
  • [fair] use the "color zap" (dirty bit and warning message "file your sheet first" ?)
  • [fixed] copying page only works for "blocks" pages.
  • [fixed] cursor-assisted deletion of objects doesn't behave as expected with 32x32 sheets.
I'm a bit surprised to see the "SpriteRam*" pointer so scattered all over the code... I might have to change them into "spriteram_no" here and there so that only some core component deal with sprdata[i] directly.

Saturday, April 19, 2025

I want to try your editors so much!

How could I resist to such a quote ?

Adeline Venture (hehe) in Shadow Of The Temple The puzzle platformer I really, really want to make some day.

I want to try your editors so much! But in order to finish, I will have to do it in an engine I already know well. Probably construct3 -- CastPixel

It made me want to pack a set of my dsgametools with contents of Castpixel's mockup pre-digested into a .spr file so that she could directly toy with the level editor ... perhaps also convert the tutogit scripts so that she'd get something playable!

So first thing to know is that SEDS works with 16x16 blocks. There is a perl script that can convert the mock-up into tiles but if used directly, it will be a complete mess as game assets.

  1. ensure things are aligned on the 16x16 grid as much as possible. That means the ladder half-way over pillar must be shifted. A few other things needs similar shifting on the mockup.
  2. SEDS shows you 64-pixels slices at once. The scripts *can* handle wider pictures, but at the moment, they'll scan e.g. first row of 256x16 pixels and output 4 64x16 rows in the first page, then another 4x64x16 chunk etc. The result is barely usable, again, because many objects bigger than 16x16 will be de-aligned and will need to be re-aligned in the DS editor.
  3. So instead, you may want to turn the mockup into a 64x* image where things are where you want. Todo: imlib2spr.pl should be able to scan the image in 64px-wide columns itself, so that this step becomes useless and the mockup remains readable.
  4. The script may remove the background color, but when it does so, it also deletes fully background blocks from the output file. This is nice to avoid redundant data, but again, it screws up alignment on such a mockup. You can scribble something on those blocks or you may turn off the background color by giving another one with --bgcolor=ff00ff. Todo: have the imlib2spr.pl tool inject empty slots on the sprite page when it encounters such full-background blocks, to preserve alignment
  5. B u t if I use --bgcolor=some-color, the tool will inject a fully-transparent block as block 0. This is required for proper operation of the game engine and the level editor, but this is useless on the sprite pages. And worse, having block 0 editable led to corrupted files in the past. todo: patch the tool so that the empty block is never used by the generated pages (and never allocated by the editor :P)

With all that taken into account, with a 64x* png file with the content of the mockup aligned on a 16x16 grid as often as possible, conversion is performed with 

SpriteEditor/bin/imlib2spr.pl cast-a-venture2.png venture.spr --nomap --nopack --blocksize=16

And the reverse operation to see how things went is

SpriteEditor/bin/spr2png.pl venture.spr /tmp/venture.png && display /tmp/venture.png

Once that looks fine, copy the venture.spr file on your SD card in the /moving/ directory, make sure you have SpriteEditor for DS at the root of your SD card and launch it.

  • once launched, press START to enter the FILE screen
  • click the |/_/ browse button to show the contents of /moving/
  • if venture.spr doesn't show up, hold L trigger and touch the "UV" button on the alphapad to filter the list of files. (holding L lets you enter the second letter of each "button").
  • touch the "venture.spr" name to load the file, then press START again to return to the edition grid.

 

Sunday, August 05, 2012

sprfix

Il me manquait un dernier outil à ma panoplie d'outils destinés à manipuler les fichiers .spr ... je m'en suis rendu compte en rédigeant le post sur sprsplit et dumpanim: sprfix.pl, un outil capable de lire un .png édité et de ré-encoder les nouvelles images dans un nouveau .spr

As soon as I got sprsplit.pl and sprmerge.pl written, I figured out I still had to write a new tool: sprfix. Its goal ? to do the opposite of spr2png -- which I've been using for years to "export" my graphics -- and re-inject new pixels where they're supposed to go. After all, using a picture editor tool such as the Gimp seems the most natural way to recover some tiles from a former file, no ?

La manipulation est encore un peu complexe, avec des étapes de préparation puis de fusion, mais finalement, un outil comme "the Gimp" est encore ce qu'il y a de plus naturel pour faire de la récupération de données, même si les copies de page à page m'ont plus ou moins permis de m'en sortir jusqu'ici.

Friday, July 25, 2008

Encore une victoire de Canard !

Yes! j'ai trouvé le moyen de produire une animation Gif à partir d'une de mes planches de sprites. C'est encore fastidieux, et il faudra scripter ça, mais au moins ça marche (enfin, sous FF en tout cas). Accrochez vous à vos baskets, voilà ce que ça donne :
# convert .spr file into a tileset image (64xn*16)
perl DS/SEDS/spr2png.pl biloucoin.spr bcoin.png
# extract the 64x48 region where we have our coin
convert bcoin.png -crop 64x48+0+656 -repage +0+0 coinb.png
# extract individual frames for the animation
convert coinb.png -crop 16x16+16+0 -repage +0+0 coin1.png
convert coinb.png -crop 16x16+32+0 -repage +0+0 coin2.png
convert coinb.png -crop 16x16+48+0 -repage +0+0 coin3.png
convert coinb.png -crop 16x16+0+16 -repage +0+0 coin4.png
convert coinb.png -crop 16x16+16+16 -repage +0+0 coin5.png
# etc.
# produce the animation using the sequence 1-2-3-4-5-a 1-a-8-b-8-9
convert -loop 0 -dispose 2 -background darkgrey -delay 10 coin1.png 
  coin2.png coin3.png coin4.png coin5.png coina.png coin1.png coina.png 
  coin8.png coinc.png coin8.png coin9.png -loop 0 -delay 10 mycoin.gif
# here we are...
Howdy! I managed to produce an animated .gif out of my sprites. That's the first step towards an "beam out animation" feature in SEDS ;)

Tuesday, May 28, 2013

extractanim.pl

Maybe you wonder why, after two teasers on "the great walking pendat", you still can't see it animated ? Well, the thing is I still haven't got any competent animation exporter so far. All the previous animations from AnimEDS were either hand-generated from static snapshots, or screencasts from either AnimEDS in desmume or from the game engine.

But that screencast tool (byzanz-record) shows its limits when one wants pixel art-level animation, and not merely a gameplay teaser: it's introducing dirty pixels all over the place.

Voilà un moment que je vous mets l'eau à la bouche avec "mon crayon qui marche", et vous n'avez toujours pas eu droit à une petite animation. Pourquoi ? eh, ben parce que je n'ai pas encore d'exporteur d'animations. Je m'en suis tiré jusqu'ici avec des animations bricolées à partir de screenshots ou des 'screencast' convertis en .gif animés tandis qu'AnimEDS tournait dans l'émulateur desmume. C'était sympa, mais l'outil de sreencast n'est pas complètement convaincant pour du pixel-art: il a trop vite tendance à rajouter du dithering dans tout les coins et des pixels parasites.

Du coup, je reprends ma doc de Imlib2 histoire d'extraire les différentes images d'une animation en .png à partir de ses descriptions puis on construira l'animation dans un 2eme temps.

So I refreshed my brain with API of the Imlib2 library I used for spr2png a while ago and started a proper animation ripper for my own .spr file format. I plan to first build static frames in .png and let a post-processing step build an animation out of that. I bet swapping will be the most annoying feature to support.

Stay tuned ...

hmm ...

edit: Well, the tools have progressed, that's sure. I still need to hack support for 32x32 blocks, though. On the other hand, it's pretty screwed for the pendat: I used pencil tiles as a quick replacement for pencil sprites content, but that's not a valid approach in the game engine, and that isn't either for the extractanim.pl tool :P

But with the "apply change to this frame and all the following" button, replacing the page and recovering graphics is a matter of 5 minutes with the DS in hands ^_^

Comme vous l'avez deviné, le truc-machin en haut est tiré d'un des premiers essais de l'outil. Il a fait de son mieux, le brave, mais j'avais été pécher mes morceaux de crayons dans la spritesheet 'blocks' plutôt que dans une spritesheet 'sprites'. Et extractanim.pl ne charge pas les blocks, évidement. Heureusement, j'avais ajouté une option "appliquer les changements à cette frame et toutes les suivantes" dans AnimEDS, du coup j'ai pu corriger tout à en 5 minutes DS en main.