24 October 2014, 02:14 | #1 |
Registered User
Join Date: Oct 2014
Location: Constanta / Romania
Posts: 202
|
Changing Icon Type
Following the discussion in: http://eab.abime.net/showthread.php?p=982493#post982493, I have not found a sensible way of changing the icon types for the icon archive at: http://aminet.net/package/pix/mwb/IconArchive short of having to use an icon editor, load each icon, change the type, save the icon, go to the shell and overwrite the .info type.
I looked up the specification of the different icon types on the Amiga and coded a small program that just changes the icon type of any .info file. Code:
/** *************************************************************************** ** Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 ** *************************************************************************** ** Provided an input type and an .info file, this program change the type ** of the icon. This is useful for icon packs where .info files would have ** to be converted manually using an icon editor. ** ** Reference: http://krashan.ppa.pl/articles/amigaicons/ **/ #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { FILE *fp; long size; char *info; int type; if(argc < 3) { printf("SYNTAX: %s <type> <info file>\n", argv[0]); printf("TYPE: 1 - disk or volume\n"); printf(" 2 - drawer (folder)\n"); printf(" 3 - tool (executable)\n"); printf(" 4 - project (data file)\n"); printf(" 5 - trashcan\n"); printf(" 6 - device\n"); printf(" 7 - Kickstart ROM image\n"); printf(" 8 - an appicon (from an app)\n"); return 1; } type = atoi(argv[1]); switch(type) { case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: break; default: printf("Unknown icon type.\n"); return 1; } fp = fopen(argv[2], "rb"); if(fp == NULL) { printf("The second argument must be an icon file.\n"); return 1; } // read size fseek(fp, 0, SEEK_END); size = ftell(fp); rewind(fp); // allocate buffer and read info = (char *) calloc(size, sizeof(char)); if(fread(info, 1, size, fp) != size) { printf("The file could not be read.\n"); return 1; } fclose(fp); if((unsigned int)info[0] != 227 && (unsigned int)info[1] != 16) { printf("The file is not an icon file (info).\n"); return 1; } // change the icon type info[48] = (char)type; // open file for write fp=fopen(argv[2], "wb"); if(fp == NULL) { printf("The file could not be found anymore.\n"); return 1; } // write the data fwrite(info, size, 1, fp); fclose(fp); free(info); return 0; } The usage is very simple:
Cheeries! |
24 October 2014, 03:28 | #2 |
Registered User
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,378
|
I guess, you can do the same and much more with ProcessIcon option SIT (Set Icon Type) written by Dirk Stoecker. http://aminet.net/package/util/wb/ProcessIcon
|
27 February 2018, 17:16 | #3 |
Registered User
Join Date: Feb 2018
Location: Brisbane Australia
Posts: 15
|
@eva
I like the simplicity of your tool and it comes in very handy. @PeterK I like this tool also, but only if I have a need to change the bitplanes or other parameters of custom icons. @Both Thanks for the tool and links, much appreciated. |
27 February 2018, 18:29 | #4 |
Registered User
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,378
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
PNG Icon to Color Icon Converter? | Leandro Jardim | request.Apps | 1 | 24 May 2010 04:39 |
Changing Icon into OS 3.9 ???? | W4r3DeV1L | support.Other | 3 | 30 November 2008 06:45 |
Changing the CrossDOS default disk icon? | SkinE | support.Apps | 2 | 01 October 2005 16:42 |
Changing default Ram Disk: icon under 3.9 | oldpx | support.Apps | 8 | 26 July 2004 20:51 |
Mass Changing Of Icon Tool Types | CodyJarrett | support.Apps | 2 | 05 March 2002 19:56 |
|
|