Using ImageMagick
Moderator: BigEvilCorporation
CORE_RL_magick_.libr57shell wrote:ppm install was successful?
Which dll is missing?
I've used Frederick's method, now all works fine, that it:
- Uninstall Perl & ImageMagick (may not be necessary but it's what I did).
- Install Strawberry Perl 5.16.3.1
- Run the command line interface (cmd).
- Type cpan (it should give you a shell).
- Type install Algorithm::Cluster (it will download and compile the module, it may download a C compiler and dmake if needed).
- You can close the command line interface.
Then
- Download ImageMagick and run the installer.
- The installer will ask you to select/unselect a few options. Check "Add application directory to the system path" and "Install developpement headers and librairies for C and C++". Do not check "Install PerlMagick for ActiveState".
- Complete the installation.
Then
- Download PerlMagick here: http://search.cpan.org/CPAN/authors/id/ ... .86.tar.gz
- Uncompress the archive.
- Run a command line interface (cmd).
- Change directory to the folder you got from uncompressing the PerlMagick archive.
- Type "perl Makefile.PL". It may complain about "No library found for -lMagickCore-Q16"
- Edit the file named Makefile (in the same directory).
- Inside this file, find a line that begins with "LDLOADLIBS = ....."
- At the end of this line, add a space, then add -lCORE_RL_Magick_
- Save the file.
- In the command line interface, in the directory where the Makefile is, type dmake and then dmake install
- You're done.
A bug in PerlMagick prevents you from installing the module by typing "install Image::Magick" under the cpan shell. Without this bug, it would that easy.
Re-download my script (that has been modified to run under Windows). You should be able to use it.
Just checks Frederick's - bitmap2md.pl - it's output dithered file, without dither, with 58 colors from 60
R57Shell:
Your script also works, without dither and make 40 colors.
With dither also 40, but your dither have too many dots.
You must add a tilemap to output, I don't know how may be used current asm.
It contain tiles, and pal. But no map, PAL ids - is commentaries.
Last edited by Ti_ on Tue Jun 11, 2013 3:45 pm, edited 2 times in total.
How many times I need to explain this bug of ImageMagick?Ti_ wrote:Your script also works, without dither and make 40 colors.
With dither also 40, but your dither have too many dots.
r57shell wrote: It will be better, if Remap dither was equal to Quantize dither in ImageMagick. But, it's not true, I don't know why.
What I mean:my_img2 will have much more noise than my_img1.Code: Select all
convert my_img.png -dither Riemersma -colors 30 my_img1.png convert my_img.png -dither Riemersma -remap my_img1.png my_img2.png
Algorithm::Cluster provides several algorithms (k-means, k-median, k-medoids...). I tried k-median and it gave better results in some cases. You can try to play with the different algorithms and their parameters. I know nothing about these algorithms, I just found k-means when searching for a method to sort the tiles into groups. I tried it and it seemed to correctly sort the tiles in most cases, so I settled for it. You can also try to create the vectors differently. I create them using the RGB values of the pixels in each tile, but I tried to use the HSV values (after doing the RGB -> HSV conversion) and it gave different results.r57shell wrote:frederic, what different clustering algo instead of K-means can be used? And may be use another tile representation for clustering?
Glad to hear that.Ti_ wrote:I've used Frederick's method, now all works fine
The output file is meant to be parsed by a script of yours. It should be easy to make a short script that can convert this into what you want. The tiles are given from left to right and top to bottom, starting at tile #0. I'll try to add a better output format.Ti_ wrote:You must add a tilemap to output, I don't know how may be used current asm.
It contain tiles, and pal. But no map, PAL ids - is commentaries.
-
- Very interested
- Posts: 208
- Joined: Mon Jun 25, 2007 7:19 pm
- Location: Besançon,France
- Contact:
hi,
I want to test the R57 modification script but when i launch the script i have this error :
When i try to install it with cpan ( Frederic Method )
It will show me this error (SGDK gcc conflict ?)
Thanks
I want to test the R57 modification script but when i launch the script i have this error :
When i try to install it with cpan ( Frederic Method )
Code: Select all
Type cpan (it should give you a shell).
- Type install Algorithm::Cluster (it will download and compile the module, it may download a C compiler and dmake if needed).
Thanks
Delete temporarily GDK paths from PATH.
save somewhere
and
and try compile again.
add GDK path again.
Code: Select all
echo %PATH%
and
Code: Select all
SET PATH=<all without GDK path>
add GDK path again.
Added new option "tiles" to select global/local dither.
http://pastebin.com/XNUUMNgi
from left to right: global (old), local (new, default).
http://pastebin.com/XNUUMNgi
from left to right: global (old), local (new, default).
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
I've been trying to upconvert images from 16 colors to 256 colors and back.
For 16-to-256, I've tried variations of:
But all I get is another 16 color bitmap. Is there a way to force it?
For 256-to-16, I've found something that works, but there's a snag.
But the palette gets rearranged so that one of the colors used winds up to be the transparent color in the palette. Is there any way to tell Imagemagick to not reorder the palette?
Thanks!
djcc
UPDATE: Nevermind. Writing my own converters.
For 16-to-256, I've tried variations of:
Code: Select all
convert -verbose backgroundforest2.bmp -type palette -colors 256 -depth 8 bmp3:backgroundforest2_256colors.bmp
For 256-to-16, I've found something that works, but there's a snag.
Code: Select all
convert -verbose backgroundforest2_gg256colors.bmp -depth 4 -type palette -colors 16 bmp3:backgroundfores2_gg256to16.bmp
Thanks!
djcc
UPDATE: Nevermind. Writing my own converters.
djcouchycouch wrote:I've been trying to upconvert images from 16 colors to 256 colors and back.
Your image has 16 colors, where you will get MORE colors?
Palette generated from image. ImageMagick doesn't know right order.djcouchycouch wrote:Is there any way to tell Imagemagick to not reorder the palette?
I'm not expert in ImageMagick.
Best way for me, it is first make image,djcouchycouch wrote:UPDATE: Nevermind. Writing my own converters.
then reduce colors (by ImageMagick/GIMP/XiQuantizer/scolorq/Retro Graphics Toolkit or anything else),
then make palette in my Palette utility, and at last, insert in converter for MD.
I have alot of different converters for different cases for MD.
And all of them use input: png image and correspondend palette.
In output you will get .gfx (tiles) and .map (map) or bunch of other stuff like machine generated .asm files. (For sprites, I have utility that pack hundreds of sprites and generates 7 files: all tiles in once and other different data like sprites configs and tiles count...)
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
It's not the colors I want, it's the format. genitile only accepts 8 bit images. so I want to take my source images (16 colors) and convert them to a tile set. to do that with genitile, I needed to convert the images. Imagemagick didn't help, so I wrote some small tools to up convert from 16 to 256 and back, keeping the palette identical.r57shell wrote:djcouchycouch wrote:I've been trying to upconvert images from 16 colors to 256 colors and back.
Your image has 16 colors, where you will get MORE colors?
I had expected Imagemagick to take the source palette, but that's not the case.Palette generated from image. ImageMagick doesn't know right order.djcouchycouch wrote:Is there any way to tell Imagemagick to not reorder the palette?
I'm not expert in ImageMagick.
I work the other way, drawing all my art assets in 16 colors from the start.Best way for me, it is first make image,djcouchycouch wrote:UPDATE: Nevermind. Writing my own converters.
then reduce colors (by ImageMagick/GIMP/XiQuantizer/scolorq/Retro Graphics Toolkit or anything else),
then make palette in my Palette utility, and at last, insert in converter for MD.
I'm doing animation via flash export to PNG but the colour palette index is always incorrect and I end up manually setting it in every image before running through the SGDK.
I'm using black in my graphics, so I want 36, 36, 36 (RGB) to be the default colour 0 (transparent) / background colour.
Is there a way I can do this using Imagemagick ?
I'm using black in my graphics, so I want 36, 36, 36 (RGB) to be the default colour 0 (transparent) / background colour.
Is there a way I can do this using Imagemagick ?
I figure this maybe an issue with Fireworks MX not exporting the transparent colour feature properly (my tools are a little dated).Stef wrote:I'm now using Gimp to set the transparent color as you can re organize the colormap as you want. I believe that you can even use the real transparent color feature of the PNG format with SGDK (at least it worked on my sprite sample).
I batch export my images (which already use the MD colour palette and are already reduced to 15 colours) from Flash MX as 24-bit colour PNGs (using Flash's 8-bit PNG export doesn't work properly it over optimises the damn things!).
I then batch process the PNGs to 8-bit using Fireworks MX (which fails to use the transparent colour feature properly). I then manually rearrange the palette values in GIMP an image at a time.
I have 114 images so as you can probably tell this is just a tad time consuming! lol I'd like to be able to export from Flash then run a script to optimise the PNGs to 8bit with the default 0 palette position if possible. I see GIMP offers batch scripting but it looks incredibly daunting I may look to see if I can do this in Python...