batch operation - RealWorld forums

Log-in or register.

batch operation

how to select a few/bunch of icons and add different sizes
Anonymous
on July 22nd 2010

how do i select more than one icon and add different icon sizes to all of them at once? for instance, i have one at 256x256 and i want to make all the practical sizes below it, like 128,96, 64, 32, 16.

Vlasta
on July 22nd 2010

Do you have the current icon as .ico file or .png or something else? And what kind of output would you like? 1 .ico file or multiple .png files?

In the usual case (you have a source .png file) and you want to create .ico with multiple sizes, just switch to Batch page in RealWorld Icon Editor, choose Create icons from images, configure your custom sizes and drag and drop the source files on the application.

Anonymous
on August 1st 2010

NO PNG. NO JPG. NO 3DM. NO OBJ. NO TIFF. NO GIF. NO BMP. JUST ICO.

i understand your "batch" operation, but YOUR batch operation is not what i want. i have .ico files they are in library mode. so there are more than one .ico files. this is past the stages of turning a non-.ico file into an .ico file. this is where there's no image to fall back on...just the .ico file...i'm tired of typing .ico! ICON...

i want to add different sizes to the icon file that's inside the library file. i can add different icon sizes one by one, but when it comes to a library full of icons, it will become homicidal to add 4 different formats to EACH of the 40+ icons inside the library file.

is this clear enough? (if this reads as if i'm agitated it's because i am, something else...plus this)

....and another thing, there's this "allocate memory" thing...wth is that?...everytime that pops up it means i can't make an icon.

THERE ARE TWO QUESTIONS (there have been many times when people do not know how to answer TWO GD questions and it makes me feel like gods going to have to hold me back)

Anonymous
on August 1st 2010

i apologize for the grammar...i'm annoyed, and it's 7am, way past my bed time.

Vlasta
on August 1st 2010

OK, you have an .ico file with 256x256 image and you want to change the .ico to also contain smaller images. (This is a sub-optimal way, it is best to have raw source images in high resolution; at least 1000x1000 pixels).

There are multiple ways how to do this. The easiest way how to do it in batch is:
1. Switch to Batch page
2. Select "Extract images from icon" and process your .ico files and you get a bunch of .png files (select the largest ones, delete the others)
3. Select "Create icons from images", select Vista / 7 format, uncheck the "Enhance icon edges..." because you probably already have it in your images. Batch process the extracted .png files.

Another way (not batch-based) is opening an .ico file, going to the "Images" panel, selecting the largest image in best color depth, clicking on "Icon operations" button (second in the toolbar) and picking "New icon from selected image" and then saving the created icon.

I'll try to prepare a specialized batch operation that would work with .ico and produce .ico, but it may take some time - I'll post it here when it is ready.

Regarding the other issue, to be on the safe side, uninstall the application, re-download the installer and install it again. For a few days after the release, there was a bug that might have caused these problems under certain conditions, mainly on 64-bit systems.

Vlasta
on August 1st 2010

OK, here is a specialized script for a batch operation.

To use it:
1. go to Batch Page
2. select for example "Custom operation #1" (eventually save it to return to it later)
3. click Configure
4. select > JavaScript < in the box next to the Operation box (previously, it contained "Icon - Make pre-XP formats")
5. copy and paste the code from here to the empty large box
6. batch process your .ico files

The sizes and color depths added to .ico file are controlled by the first 2 lines of the script, you can change it at your will to include more or less formats.

var newSizes = new Array(16, 24, 32, 48, 256);
var newDepths = new Array(4, 8, 32);

var icon = Document.Icon;
var formats = icon.FormatIDs;
var formatcount = formats.length;
if (formatcount == 0)
	Context.StopProcessing(true);
var best = 0;
for (var i = 1; i < formatcount; ++i)
{
	if (formats[i].ColorDepth > formats[best].ColorDepth ||
		(formats[i].ColorDepth == formats[best].ColorDepth &&
		 formats[i].SizeX > formats[best].SizeX))
		best = i;
}
var image = icon.GetImage(formats[best]);
for (var j = 0; j < newSizes.length; ++j)
{
	for (var k = 0; k < newDepths.length; ++k)
	{
		for (var i = 0; i < formatcount; ++i)
		{
			if (formats[i].ColorDepth == newDepths[k] &&
				formats[i].SizeX == newSizes[j] &&
				formats[i].SizeY == newSizes[j])
				break;
		}
		if (i == formatcount)
		{
			// create format
			var newFormat = icon.CreateFormatID(newSizes[j], newSizes[j], newDepths[k]);
			icon.InsertImage(newFormat);
			var dupl = image.Duplicate();
			var resample = Operation.Create("Raster Image - Resample");
			resample.Mode = 1;
			resample.SizeXAbs = newSizes[j];
			resample.SizeYAbs = newSizes[j];
			Operation.Execute(resample, dupl);
			Blender.Compose(icon.GetImage(newFormat), 0, 0, newSizes[j], newSizes[j], dupl, 0, 0, 0, Blender.OpSrc);
		}
	}
}

New image formats are added only if they do not already exist and the largest image in best color depth is used as the source.

sixλxis
on August 1st 2010
New image formats are added only if they do not already exist and the largest image in best color depth is used as the source.

Just like the TGA codec?

Vlasta
on August 1st 2010

I meant image format inside an .ico file - defined by size and color depth.

Anonymous
on August 13th 2010

GREAT...thanks. now one new thing...

is this correct:
4 = 16 colour depth
8 = 256 color depth
32 = Smooth Edge

Anonymous
on August 13th 2010

SWEET....the code you gave me works perfectly....

ignore the last message because i found my answer.

also, there's no such thing as 16 or 64....i found out i can only have 3 different qualities of icons... the 16 colour depth, the 256 colour depth, and the Smooth Edge.

sad, unless those are the only quality types ever to be used...

oh well.

sixλxis
on August 14th 2010

Did you visit the wiki and search "color depth"?

Vlasta
on August 14th 2010

Yes, 4, 8, and 32 are the only feasible color depths. Technically, you can also have icons with 1 or 24 bits per pixel, but they have no practical value.

Anonymous
on August 14th 2010

=sixaxis= no, and i'm partially afraid i might get really confused.

=vlasta= okay. well, thank you for your help. ...ha ha...now i have to do all my editing and library creating before the trial period is up.

Page views: 8822       Posts: 13      
Select background
What about ICL files?
Vista & Win 7 icons