Code Monkey home page Code Monkey logo

alferd-spritesheet-unpacker's Introduction

Alferd-Spritesheet-Unpacker

What is this?

ASU is a simple spriting tool which takes an animation spritesheet image, with irregular sized and positioned sprites, and automatically finds the boundaries of each sprite so they can be exported as individual images.

The interesting bit

So the actual logic to find the individual sprites can be found in ASU\BO\RegionUnpacker.vb.

To use

Just double click the .sln file.

Projects

/ASU

This is the main Windows app and contains all the forms.

/ForkandBeard.Util

Contains some misc classes I've used in other projects. ASU uses to find rectangle bounds and distances.

/ForkandBeard.Logic

Again contains some misc classes I've used in other projects. ASU uses it for Exception handling and getting version numbers.

/ImageQuantizers

ASU uses this one to preserve a bitmap's palette index - which the Mugen community go crazy over if you destroy a bitmap's indexed palette. I didn't wrote this project (forget where I found it).

Code quality

When I wrote this app I was working for a company which worked in VB and one of their dev standards was Hungarian notation, so it was just easiest for me, at that time, to write to that standard for ASU. I also, originally, never planned on releasing it, so it was only ever going to be a tool for me, which will hopefully explain some of its shoddyness. Ideally I'd like to move all the code over to C# and remove all the Hungarian notation and other kak.

Updates

06/11/2014 - All VB code has now been replaced with C#

alferd-spritesheet-unpacker's People

Contributors

bitdeli-chef avatar forkandbeard avatar nestelami avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alferd-spritesheet-unpacker's Issues

Feature Request: original name detection / transparency bug

first this tool is great to unpack sprite sheet it helped me a lot of times however it's going to save me a lot of times if it can rename image with its original names that in the plist file like this example. what i mean if only can read plist file along with the png sprite files and extract image with its original name.
As this example of plist coordinate of one image

< key>image name xxx< /key>
< dict>
< key>frame< /key>
< string>{{181, 1142}, {509, 171}}< /string >
< key>offset
< string>{-2, 77}< /string >
< key>rotated< /key >
< string>false
< key>sourceColorRect< /key >
< string>{{59, 153}, {509, 171}}< /string >
< key>sourceSize< /key >
< string>{630, 631}< /string >
< /dict >

ASU should export the image as "image name xxx.png" and not as a number 01.png

Also there image pieces that should be exported as one single image as for ASU treat it as multiple images that why is so important if ASU can read plist coordinates {{181, 1142}, {509, 171}} its going to solve this problem even there is the ability to combine selection.

Also the software its doesnt have smart detection of transparency as sometimes it doesn't detect some images and remove pieces of images that share the same color as the background of sprite sheet imported even the sprite sheet have transparent background when imported to ASU the background become black and if there is black image inside the sprite sheet it won't be detected at all the same thing happened with transparent image that is inside the sprite sheet it will be exported with different color or it won't be exported at all.

Spritesheet Unpacker removes all black pixels.

For some reason, whenever I try to export a sprite sheet, any and all (completely) black pixels are removed from the exported sprites.

What it should look like:
What it should look like

What it looks like:
What it looks like

Here's my sprite sheet if that helps at all:

pikachu back

Feature request

Maybe make please the zoom in and zoom out feature? To make the life a little easier?

Select all order not respected

When choosing the select all order it doesn't actually select them in the correct order, making each of the frames export in the proper order. Tried with numerous sprite sheets. The order seems all over the place. Top left may export 1, 0, 4, 3, etc.

Kaspersky Detects Program as "Malicious" After Extracting

I tried the latest version of ASU, extracted various sprites, and after extracting, Kaspersky detected that this program was doing something "malicious". Are there any viruses hiding in your program or is it just a false positive?

Export Error

System.Exception: An error occured whilst exporting frames.
---> System.IO.DirectoryNotFoundException: 未能找到路径“D:\Develop\AS3\Projects\TestProj\embed\Imgs\Export”的一部分。 在 System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 在 System.IO.Directory.InternalGetFileDirectoryNames(String path, String userPathOriginal, String searchPattern, Boolean includeFiles, Boolean includeDirs, SearchOption searchOption) 在 System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption) 在 System.IO.Directory.GetFiles(String path) 在 ASU.UI.MainForm.ExportUnpackers(List1 unpackers) 位置 C:\Users\MCooper\Documents\GitHub\Alferd-Spritesheet-Unpacker\ASU\UI\MainForm.cs:行号 1079 --- 内部异常堆栈跟踪的结尾 --- 在 ASU.UI.MainForm.ExportUnpackers(List1 unpackers) 位置 C:\Users\MCooper\Documents\GitHub\Alferd-Spritesheet-Unpacker\ASU\UI\MainForm.cs:行号 1222 在 ASU.UI.MainForm.ExportButton_Click(Object sender, EventArgs e) 位置 C:\Users\MCooper\Documents\GitHub\Alferd-Spritesheet-Unpacker\ASU\UI\MainForm.cs:行号 1228

Works fine when the exportlocation is short

Drag/Drop not working with Wine

I'm trying to use the 11 version on Ubuntu S.O. with the help of Wine .

Unfortunately, the drag and drop fails .
Is it possible to add an "open file button" in which type the path ?

Thanks,
J

P.S.: on Windows 7 the unpacker is perfect :)

Export in Json format

Please also add an additional option to export a JSON file where we can customize the label/name for each frame/animation.

UI issues: 4k and 16x16 pixie art

The previewer has some serious issues when working on a 4k screen with 175% DPI scaling while working with tiny 16x16 pixel graphics.

It was pretty tricky to use, but overall glad this tool exits, thank you for releasing it, it saved me a ton of time having to hand cut a texture atlas I lost the original images too.

Sprite parts disappearing

Sometimes when I try and put the sprite into my animator it looks fine before I put it in, but when I put it some parts of it just disappear completely and I have no idea why

Drag/Drop not working

When I downloaded the latest version and used the program it was working fine. Until I reopened it again and tried to drag the same png file into the software, it shows a block sign that I cannot drag/drop, even when I copy and use copy to clipboard it says nothing is copied. I tried using it on different png files with no success.

EDIT: I have figured out the problem after a little search here an there, this solved my problem for some reason: http://www.mladengradev.com/en/how-to-get-back-drag-and-drop-in-windows-8/

EDIT2: Another problem when exporting is that I get this error:

 System.Exception: An error occured whilst exporting frames. 
 ---> System.ArgumentException: Parameter is not valid.   

 at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)   
 at ASU.UI.MainForm.ExportUnpackers(List`1 unpackers) in C:\Users\MCooper\Documents\GitHub\Alferd-Spritesheet-Unpacker\ASU\UI\MainForm.cs:line 1022   
 --- End of inner exception stack trace ---   

 at ASU.UI.MainForm.ExportUnpackers(List`1 unpackers) in C:\Users\MCooper\Documents\GitHub\Alferd-Spritesheet-Unpacker\ASU\UI\MainForm.cs:line 1136   
 at ASU.UI.MainForm.ExportButton_Click(Object sender, EventArgs e) in C:\Users\MCooper\Documents\GitHub\Alferd-Spritesheet-Unpacker\ASU\UI\MainForm.cs:line 1142`

Hang on Windows 10 when PromptForDestinationFolder=true

Release: 15.
I drag-n-drop png on your app.
I've got: hang (more than 2 minutes on Core i7).
Same behavior I had in 13'th release on Windows 7 several months ago. I even don't know what this flag does, but it is set to "true" by default...

When

<add key="PromptForDestinationFolder" value="false"/>

there is no hang. That issue keeps bothering me each time I update your app 😄

Exception during drag and drop

Error occurred during DragDrop.

ASU ver.16

System.NullReferenceException: Object reference not set to an instance of an object.   

 at ASU.UI.MainForm.CreateUnpacker(Bitmap image, String fileName) in C:\Users\MCooper\Documents\GitHub\Alferd-Spritesheet-Unpacker\ASU\UI\MainForm.cs:line 86   
 at ASU.UI.MainForm.MainPanel_DragDrop(Object sender, DragEventArgs e) in C:\Users\MCooper\Documents\GitHub\Alferd-Spritesheet-Unpacker\ASU\UI\MainForm.cs:line 459

Spritesheet Transparency recognition failure

The Sprite sheet has a green background and each sprite frame has transparency in it because of antialias borders that obviously must be preserved. However, compared to older versions, for some reason, the program puts the colour black in place of the transparent areas. This makes the sprites being saved without transparency. Versions 14 and lower seem to lack this issue. Version 15-17 are not viable for testing due to load times/freezing/crashes (the sprite sheet is quite big). Issue is seen on versions 18-19. Version 14 and lower however, will also export frames with duplicates.
image
image

System Exception if there is whitespace in the export path.

After copying and pasting path, i.e. C:\Project\etc\ there was a System Exception. Removing the trailing whitespace fixes the issue.

`System.Exception: An error occured whilst exporting frames.
---> System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.

 at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)   
 at ASU.UI.MainForm.ExportUnpackers(List`1 unpackers) in C:\Users\MCooper\Documents\GitHub\Alferd-Spritesheet-Unpacker\ASU\UI\MainForm.cs:line 1136   
 --- End of inner exception stack trace ---   

 at ASU.UI.MainForm.ExportUnpackers(List`1 unpackers) in C:\Users\MCooper\Documents\GitHub\Alferd-Spritesheet-Unpacker\ASU\UI\MainForm.cs:line 1222   
 at ASU.UI.MainForm.ExportButton_Click(Object sender, EventArgs e) in C:\Users\MCooper\Documents\GitHub\Alferd-Spritesheet-Unpacker\ASU\UI\MainForm.cs:line 1228`

Feature Request: Specify size of each sprite

I have a spritesheet where each of the sprites is exactly 64x64, I would like to specify that so the alignment is correct on the exported images (instead of clipping to the visible portion)

Feature Request: Undo/Redo Functionality

It would be greatly appreciated if this program had functionality to allow you to undo and redo actions. I haven't used this program a lot, but when I have used it, I've found it astoundingly time-consuming because of little mistakes I make that force me to start all over again.

If also possible, the ability to set how many actions you want to store in your history (like in Photoshop) would also be awesome.

Mistakes would be reduced if you also added a zooming feature, but someone else already requested that.

Feature request: transparent border with customizable width around each exported sprite

It would be very useful for my own workflow so not sure what others would say , a lot of times i dont need every sprite to be touching its borders and need transparent area all around without any solid pixels at the border.
Because when sprite1 and 2 are stacked one next to another then sometimes the pixels from sprite1 and sprite2 touch themselves at the borders creating one big sprite on spritesheet, that makes it harder to unpack later and identify as 2 separate sprites.

Feature request: Zoom in and out on imported spritesheet

@ForkandBeard
I need a feature, which makes it possible for me to zoom in om my imported spritesheet. The issue is that I have created a very small spritesheet

8 bit tiles, with a width of 128x128, but I have trouble selecting all my sprites in the imported spritesheet, due to the fact, that I can't zoom in or out on the spritesheet.

Hopes it can be done.

Sprites are not being auto selected

I've used this spritesheet unpacker before and it's worked fine but I opened it up again and drag the sheet I wanted unpacked but nothing happens. It used to automatically select sprites and outline them but now it doesn't. I've downloaded the newest version and the one before that but still nothing. I'm not sure what's going on. I have checked in the options but there's nothing really in there that could help me.

Crashed when dropping non-pixel related

I tried to drop the sprite I'm using and it crashes like I received this
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

 at System.Collections.Generic.Dictionary`2.Resize()   
 at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)   
 at ASU.BO.ImageUnpacker.RemoveTransparencyFromImage(Bitmap image) in C:\Users\MCooper\Documents\GitHub\Alferd-Spritesheet-Unpacker\ASU\BO\ImageUnpacker.cs:line 70   
 at ASU.BO.ImageUnpacker..ctor(Bitmap image, String fileName, Boolean removeTransparency) in C:\Users\MCooper\Documents\GitHub\Alferd-Spritesheet-Unpacker\ASU\BO\ImageUnpacker.cs:line 51   
 at ASU.UI.MainForm.CreateUnpacker(Bitmap image, String fileName) in C:\Users\MCooper\Documents\GitHub\Alferd-Spritesheet-Unpacker\ASU\UI\MainForm.cs:line 137   
 at ASU.UI.MainForm.MainPanel_DragDrop(Object sender, DragEventArgs e) in C:\Users\MCooper\Documents\GitHub\Alferd-Spritesheet-Unpacker\ASU\UI\MainForm.cs:line 475

I just trying to use this just to use it for Scratch

System.Exception error on export

Tried to unpack a spritesheet and I received this error. No clue how to fix. I have cloned the source to github desktop and manually started the application from ASU.exe
System.Exception: An error occured whilst exporting frames.
---> System.ArgumentException: Parameter is not valid.

 at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)   
 at ASU.UI.MainForm.ExportUnpackers(List`1 unpackers) in C:\Users\MCooper\Documents\GitHub\Alferd-Spritesheet-Unpacker\ASU\UI\MainForm.cs:line 1108   
 --- End of inner exception stack trace ---   

 at ASU.UI.MainForm.ExportUnpackers(List`1 unpackers) in C:\Users\MCooper\Documents\GitHub\Alferd-Spritesheet-Unpacker\ASU\UI\MainForm.cs:line 1222   
 at ASU.UI.MainForm.ExportButton_Click(Object sender, EventArgs e) in C:\Users\MCooper\Documents\GitHub\Alferd-Spritesheet-Unpacker\ASU\UI\MainForm.cs:line 1228

Separate image even though there's no space between them

yeah
As you can see, the bow is separated from the image, requiring manual work, which without zoom (the top left doesn't help when you can't move your mouse 1 px to the left ! ) is tedious.
I checked the image and those parts of the bow aren't separated, they're just diagonally adjacent to the pixel that's in the image. Setting the distance to +1 doesn't work in this scenario since it becomes just one image the whole thing.

Quick Guide and FAQ links are dead! - Please include guide within ASU.zip!

In the READ_ME.txt, the latter two links are dead - 404 Error.

Thanks for downloading 'Alferd Spritesheet Unpacker'.

++ For the latest version please visit:	++
	https://github.com/ForkandBeard/Alferd-Spritesheet-Unpacker/releases

++ Quick guide:	++
	http://www.alferdspritesheetunpacker.forkandbeard.co.uk/forkandBeard/apps/AlferdSpritesheetUnpacker/Screenshots.aspx

++ Troubleshooting:	++
	http://www.alferdspritesheetunpacker.forkandbeard.co.uk/forkandBeard/apps/AlferdSpritesheetUnpacker/FAQ.aspx

This means there is no guide available to use this program online or offline.

Please include an offline guide with the ASU download .zip - for convenience and security.

Hint: Free writing program 'Typora' can make this easy - it'll spit out a html, pdf easily - with images!

Feature request: Overwrite on source file for individual sprite cropping

Mr.Cooper, this tool is wonderful but I'm not able to figure out if it can achieve a particular task in mind. The thing is that I have a huge number of sprites that have are ready to be used in a game. I have a issue with the large unused blank space on all these sprites and hence I tried loading them all into Alferd unpacker and having the program crop them neatly in accordance to their shape and save them. It does this, but instead of overwriting the original file and keeping the source name intact, it saves each sprite into a folder that is designated with the source sprite's file name. I was hoping to know if you may know a way to save these files in a manner of overwriting them over their original source and keeping the file name intact.

It would be wonderful if that's possible.

"Combine Selected" won't work well

That function appear to work when you use it,but when you try to export the combined sprites,the program just export the sprite that you tried to combine,not the sprite that was created after you combine It,even the program show It when you select all the sprites to export. (See the attached image below)
screenshot_1

I don't know if It's my fault or something,but I can't make It work properly,even combining all the small frames in one,and combining them to the main sprite won't work..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.