English Amiga Board


Go Back   English Amiga Board > Support > support.Apps

 
 
Thread Tools
Old 14 December 2017, 23:19   #1
MickGyver
Registered User

MickGyver's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 191
How to reduce colors in iff/ilbm images?

Hi! I'm trying to figure out a good workflow for using Cosmigo Pro Motion to create graphics for an Amiga game. Pro Motion can save images as iff but the problem is that those images will be 256 colors.

Is there a tool that can batch reduce the colors of iff images? I tried XNView and NConvert that comes with it. It almost works, colors can be reduced but the order of colors in the palette is altered (the original images made in Pro Motion only uses the first 32 colors).
MickGyver is offline  
AdSense AdSense  
Old 15 December 2017, 00:32   #2
Akira
Registered User

Akira's Avatar
 
Join Date: May 2001
Location: New York
Posts: 19,050
I know this isn't the answer you want, but how married are you to Cosmigo Pro? because grafx2 can work with smaller palettes.

At the very least I am sure you can use it to load your work and save properly, but it won't batch.
Akira is offline  
Old 15 December 2017, 02:32   #3
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 3,315
PPaint.
idrougge is offline  
Old 15 December 2017, 13:17   #4
Shatterhand
Warhasneverbeensomuchfun

Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 35
Posts: 2,773
I second Grafx2 . This app has been a Godsend for me to work/draw amiga graphics.
Shatterhand is offline  
Old 15 December 2017, 13:55   #5
nobody
Registered User

nobody's Avatar
 
Join Date: Dec 2013
Location: GR
Age: 40
Posts: 1,069
Grafx2 for the job you want to do. Promotion is a superior package for making 256 color pixel art. It has a truck of features you won't need for a (usually) simple Amiga job.
nobody is offline  
Old 15 December 2017, 15:58   #6
Akira
Registered User

Akira's Avatar
 
Join Date: May 2001
Location: New York
Posts: 19,050
grafx2 is really great, I refused to use anything but DPaint IV for years, but grafx2 changed all that.

There are some missing features I would still love to have (like color cycling), otherwise it's amazing.
Akira is offline  
Old 15 December 2017, 22:13   #7
MickGyver
Registered User

MickGyver's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 191
Thanks for your suggestions, I appreciate it! I tried grafx2, it can reduce the palette colour count but for some reason it removes the colours that are not used in the images, is there a fix for this?

To clarify, the graphics are already made for the PC version of the game but need to be reworked for 16 or 32 colours. Pro Motion have good tools to remap colours etc so it would be the best solution to manually reduce the colours and my pixel artist is also used to that program. I'm not familiar with grafx2 and I know that my pixel artist is not too keen on using another tool.

This will leave the final conversion to me, and the only thing i would need to be able to do is just reduce the palette with not changing the colours in the used indices. I know I will have to do this several times so i'm not too keen on doing it manually either.

I tried Personal Paint and it seemed to be able to reduce the colour count without any problems. It can also be automated with arexx, the only problem now is that I don't have any documentation for the arexx commands for ppaint, is such a reference available?
MickGyver is offline  
Old 16 December 2017, 12:47   #8
MickGyver
Registered User

MickGyver's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 191
I managed to figure out the ARexx commands needed from the examples supplied with PPaint. I made a script that converts all png images in a folder to iff/ilbm reducing colours if you specify the target colour count in the filename (like image[32].png). This method seems to work ok. If more colours than target colour count are used in the image, the colours will be remapped, otherwise the colour count is just reduced (not changing the palette read from the png image). I'm including the script here if somebody else needs it.

Code:
/* Personal Paint Amiga Rexx script */

/* $VER: PngToIff.pprx 1.0 */

/* 
This script will convert all png images to iff/ilbm in the folder where the script is run.
The colours will be reduced if target colour count specified in the filename
inside brackets, for example: image[32].png
More than 2MB RAM will be needed for larger images
*/

IF ARG(1, EXISTS) THEN
	PARSE ARG PPPORT
ELSE
	PPPORT = 'PPAINT'

IF ~SHOW('P', PPPORT) THEN DO
	IF EXISTS('WB31:Apps/PPaint/PPaint') THEN DO
		ADDRESS COMMAND 'Run >NIL: WB31:Apps/PPaint/PPaint'
		DO 30 WHILE ~SHOW('P',PPPORT)
			 ADDRESS COMMAND 'Wait >NIL: 1 SEC'
		END
	END
	ELSE DO
		SAY "Personal Paint could not be loaded."
		EXIT 10
	END
END

IF ~SHOW('P', PPPORT) THEN DO
	SAY 'Personal Paint Rexx port could not be opened'
	EXIT 10
END

ADDRESS VALUE PPPORT
OPTIONS RESULTS
OPTIONS FAILAT 10000

Version 'REXX'
IF RESULT < 7 THEN DO
	RequestNotify 'PROMPT "'txt_err_oldclient'"'
	EXIT 10
END

LockGUI
tmpfname = '_filelist.txt'
ADDRESS COMMAND 'List >'tmpfname' NOHEAD PAT=(#?.png) LFORMAT="*"%s%s*"" FILES'
IF OPEN('listfile', tmpfname, 'R') THEN DO
	DO FOREVER
		curfname = READLN('listfile')
		IF EOF('listfile') THEN BREAK
		LoadImage curfname 'FORCE QUIET'
		IF RC = 0 THEN DO
			LoadBrush curfname 'FORCE QUIET'
			GetBrushAttributes 'WIDTH'
			xmax = RESULT - 1
			GetBrushAttributes 'HEIGHT'
			ymax = RESULT - 1
			GetBrushAttributes 'HANDLEX'
			hanx = RESULT
			GetBrushAttributes 'HANDLEY'
			hany = RESULT
			IF POS("[32]", curfname) > 0 THEN Set '"COLORS=32"' 'FORCE'
			ELSE IF POS("[16]", curfname) > 0 THEN Set '"COLORS=16"' 'FORCE'
			ELSE IF POS("[8]", curfname) > 0 THEN Set '"COLORS=8"' 'FORCE'
			ELSE IF POS("[4]", curfname) > 0 THEN Set '"COLORS=4"' 'FORCE'
			ELSE IF POS("[2]", curfname) > 0 THEN Set '"COLORS=2"' 'FORCE'
			ELSE Set '"COLORS=256"' 'FORCE'
			len = LENGTH(curfname)
			newfname = SUBSTR(curfname, 2, len-6) || ".iff"
			DefineBrush 0 0 xmax ymax
			IF RC = 0 THEN DO
				SetBrushAttributes 'HANDLEX' hanx 'HANDLEY' hany
				SaveBrush newfname 'FORMAT ILBM' 'FORCE'
			END
		END
	END
	CALL CLOSE('listfile')
END
ADDRESS COMMAND 'Delete >NIL: 'tmpfname
UnlockGUI
Quit 'FORCE QUIET'
Attached Files
File Type: zip PngToIff.zip (1.6 KB, 16 views)
MickGyver is offline  
Old 16 December 2017, 14:08   #9
WayneK
Registered User
 
Join Date: May 2004
Location: Somewhere secret
Age: 44
Posts: 253
Quote:
Originally Posted by witchmaster View Post
Thanks for your suggestions, I appreciate it! I tried grafx2, it can reduce the palette colour count but for some reason it removes the colours that are not used in the images, is there a fix for this?
Yes, the fix is just include every colour in the image... eg: a 16col image, draw a 16-wide stripe of 1 pixel of each colour. Then when you convert from IFF->RAW just exclude the extra pixels (or cut them off in a hexeditor, whatever you prefer).
WayneK is offline  
Old 18 December 2017, 17:49   #10
Akira
Registered User

Akira's Avatar
 
Join Date: May 2001
Location: New York
Posts: 19,050
Quote:
Originally Posted by witchmaster View Post
Thanks for your suggestions, I appreciate it! I tried grafx2, it can reduce the palette colour count but for some reason it removes the colours that are not used in the images, is there a fix for this?
I think if you move all colors to your first 16/32/whatever, and then zero out everything else, it will save as that amount of colors. If you use "reduce", it will zap the unused, yes. (it would be a good suggestion to change this behaviour, I'll make it)

Another tip: load an image with at least one pixel of every color in it, order the palette the way you want, hit zap/reduce, to make sure you just have those.
Then you can SAVE The palette. Use format PAL to save, this will only save the palette. Load the palette onto any image you want and it will use the colors and order you saved.
Akira is offline  
Old 18 December 2017, 19:57   #11
MickGyver
Registered User

MickGyver's Avatar
 
Join Date: Oct 2008
Location: Finland
Posts: 191
Quote:
Originally Posted by WayneK View Post
Yes, the fix is just include every colour in the image... eg: a 16col image, draw a 16-wide stripe of 1 pixel of each colour. Then when you convert from IFF->RAW just exclude the extra pixels (or cut them off in a hexeditor, whatever you prefer).
Quote:
Originally Posted by Akira View Post
I think if you move all colors to your first 16/32/whatever, and then zero out everything else, it will save as that amount of colors. If you use "reduce", it will zap the unused, yes. (it would be a good suggestion to change this behaviour, I'll make it)

Another tip: load an image with at least one pixel of every color in it, order the palette the way you want, hit zap/reduce, to make sure you just have those.
Then you can SAVE The palette. Use format PAL to save, this will only save the palette. Load the palette onto any image you want and it will use the colors and order you saved.
Cheers! Zeroing out the unused colours and saving seems to work fine.
MickGyver is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
IFF ILBM Commpression Optimiser Trachu Coders. General 7 29 May 2016 08:32
iff/ilbm on NDOS disk ???? SkulleateR support.Other 10 11 February 2016 18:47
OS X Quick Look plugin for IFF ILBM images dalton News 12 06 February 2016 01:59
Reduce size of an IFF image? BarryB support.Apps 18 19 September 2015 03:54
IFF/ILBM structures .... freddix Coders. General 7 18 September 2006 09:54

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 22:57.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Page generated in 0.40524 seconds with 13 queries