English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 30 May 2023, 18:15   #4181
AMIGASYSTEM
Registered User
 
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Age: 70
Posts: 8,248
Sorry PeterK, I would like if possible a little help with an application to change the Icon type on AROS (at the moment there is nothing on AROS x86 that does this, let's wait for miker to do it)

On Aminet I found "seticontype" which includes the sources in "C", I tried to compile it on AROS One x86, the binary works fine with standard Amiga icons, but it doesn't work with DualPNG icons, can something be added in the source (that I can do) to make it compatible with DualPNG icons?


http://aminet.net/package/util/wb/seticontype
AMIGASYSTEM is offline  
Old 30 May 2023, 19:06   #4182
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
Although I like Eva very much , her SetIconType program cannot work with PNG icons, because it changes the type directly in the .info file, presuming that this file has an Amiga icon format and structure.

But unfortunately, PNG icons are containing only PNG data and chunks. So, if a program tries to change the icon type by writing directly to the DiskObject offset $30 (do_Type) it can only trash a PNG icon structure.

The same thing has happened already with the AsimCDFS filesystem by writing the icon position directly into the .info file. We had a discussion here some years ago.

No, PNG icons don't have a fixed position for the icon type data. That is stored somewhere after the first IDAT chunk in the icOn chunk, but you have to parse the whole PNG structure and the icOn chunk to find out where it is exactly stored.

Last edited by PeterK; 30 May 2023 at 19:45.
PeterK is offline  
Old 30 May 2023, 19:37   #4183
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
Quote:
Originally Posted by pixie View Post
But I used it before, but i had the bad luck of trying with icons that didn't have alpha channel, so I got the idea it was somehow flawed. Another thing is that I want to downsize a bunch of icons, so I still have to use ImageConvert and CopyIcon. I guess I will have a pick in your script to help me do it!
You can even convert OS 3.5 ColorIcons with a transparency mask but no alpha channel into PNG icons. I've tried that and it reduces the size of these ColorIcons icons, but then you can't load them with the OS icon.library anymore.

And I also did some tests with icon scaling by just adding the necessary options to the two ImageConverter lines in my script: for example "-w 64 -h 64" would change the size of all icons to 64 pixels width and/or height by keeping the aspect ratio. If you don't want to preserve the aspect ratio but prefer always exactly the specified dimensions then also add the option -force. Read the ImageConverter syntax for more available options.
PeterK is offline  
Old 30 May 2023, 19:51   #4184
AMIGASYSTEM
Registered User
 
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Age: 70
Posts: 8,248
I was asking this because a similar program "IconType" on OS3/AROS 68k can do this !

Last edited by AMIGASYSTEM; 31 May 2023 at 22:17.
AMIGASYSTEM is offline  
Old 30 May 2023, 20:01   #4185
pixie
Registered User
 
pixie's Avatar
 
Join Date: May 2020
Location: Figueira da Foz
Posts: 340
Quote:
Originally Posted by PeterK View Post
You can even convert OS 3.5 ColorIcons with a transparency mask but no alpha channel into PNG icons. I've tried that and it reduces the size of these ColorIcons icons, but then you can't load them with the OS icon.library anymore.
It was the OS4Icons.info from the "icondemoHAM8.adf" disk. The thing is if I had looked carefully it was clear that it had no alpha channel...

Quote:
Originally Posted by PeterK View Post
And I also did some tests with icon scaling by just adding the necessary options to the two ImageConverter lines in my script: for example "-w 64 -h 64" would change the size of all icons to 64 pixels width and/or height by keeping the aspect ratio.
Nice!!!
pixie is offline  
Old 30 May 2023, 20:55   #4186
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
Quote:
Originally Posted by AMIGASYSTEM View Post
I was asking this because a similar program "IconType" on OS3/AROS 68k can do this !
If you want to write a program doing that then you have to load the icon, no matter which format it has, by using the icon.library functions GetDiskObject() or GetIconTagList(). As a result icon.library will give you a pointer to a DiskObject structure in memory. In that structure at offset $30 you will find the byte do_Type, which is 1=Disk, 2=Drawer, 3=Tool, 4=Project, 5=Trashcan, 6=Device, 7=Kickstart, 8=AppIcon. You can change that byte, but if you want to do it correctly then you also have to make sure that a pointer to a valid DrawerData structure is supplied for the type Disk, Drawer and Trashcan. Ok, most people just forget to do that, but fortunately, icon.library also checks the DiskObject structure for the missing DrawerData and fixes these mistakes. So, finally you can write back the modified DiskObject structure with a call to PutDiskObject() or PutIconTagList(), and that should be all.

Don't ask me! No, I'm not a tool coder to do that, although I know a very little bit about C programming, too.
PeterK is offline  
Old 30 May 2023, 21:11   #4187
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
Quote:
Originally Posted by pixie View Post
It was the OS4Icons.info from the "icondemoHAM8.adf" disk. The thing is if I had looked carefully it was clear that it had no alpha channel...
Yes, that was my mistake: on these IconDemoADF images I must have saved some of the icons in the main drawer by using the 680x0 versions, and thus these icons were converted to the OS 3.5 format automatically. Or I've done that, because there was not enough free space left on these floppies. PNG or zlib compressed ARGB TrueColor icons may need more space than RLE compressed chunky pixels (1 byte per pixel) after a color reduction.

But the icons in the PNG and the OS4 drawers are still in their original TrueColor format with a real alpha channel.
PeterK is offline  
Old 30 May 2023, 21:34   #4188
AMIGASYSTEM
Registered User
 
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Age: 70
Posts: 8,248
Quote:
Originally Posted by PeterK View Post

Don't ask me! No, I'm not a tool coder to do that, although I know a very little bit about C programming, too.

I don't know "C" either, I just compile some source, I will wait for mike's program
AMIGASYSTEM is offline  
Old 31 May 2023, 09:27   #4189
pixie
Registered User
 
pixie's Avatar
 
Join Date: May 2020
Location: Figueira da Foz
Posts: 340
Quote:
Originally Posted by PeterK View Post
And I also did some tests with icon scaling by just adding the necessary options to the two ImageConverter lines in my script: for example "-w 64 -h 64" would change the size of all icons to 64 pixels width and/or height by keeping the aspect ratio. If you don't want to preserve the aspect ratio but prefer always exactly the specified dimensions then also add the option -force. Read the ImageConverter syntax for more available options.
I altered your script so that it apply a given scale it and it doesn't seem to work. But if I do it on the shell it does!

EDIT: This happens only when I do batch convert (pick a folder a let it convert all the icons) if I pick one given icon it works fine.
Attached Files
File Type: zip ConvertToPngIcon.zip (2.5 KB, 26 views)

Last edited by pixie; 31 May 2023 at 09:38.
pixie is offline  
Old 31 May 2023, 12:45   #4190
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
No sorry, but multi-selection of a bunch of icons is not supportrd by the script, because then it would have to handle an array of arguments. Too much work for a lazy guy like me
It's not yet a ChatGPT proggy, maybe in some years ...
... be patient, one icon at a time is enough ...

Hmm, an icon height of 49 pixels looks a bit strange for me ?? But the script is ok.
PeterK is offline  
Old 31 May 2023, 14:10   #4191
pixie
Registered User
 
pixie's Avatar
 
Join Date: May 2020
Location: Figueira da Foz
Posts: 340
Quote:
Originally Posted by PeterK View Post
No sorry, but multi-selection of a bunch of icons is not supportrd by the script, because then it would have to handle an array of arguments. Too much work for a lazy guy like me
Well, you may have superseded yourself because if I choose the root folder it convert all the icons present!

Quote:
Originally Posted by PeterK View Post
Hmm, an icon height of 49 pixels looks a bit strange for me ?? But the script is ok.
Those which I want to convert are 64px wide, while it's good for 4k I prefer to have it in 1080p. 48px wide is about the dimension of os3.2 icons, which I like but I want them to have alpha, This way I can have a cool backdrop and it will blend perfectly!

In the anexed picture you have on top left os4.1 icon converted, the regular os4 on the right and the 3.2 in the bottom
Attached Thumbnails
Click image for larger version

Name:	icons.png
Views:	35
Size:	8.8 KB
ID:	79204  
pixie is offline  
Old 31 May 2023, 19:32   #4192
AMIGASYSTEM
Registered User
 
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Age: 70
Posts: 8,248
pixie, the icons you converted, do not have the same quality as the original ones, if you enlarge them you will notice stripes.

To do a good job, extract the images with icon editor !

The OS 3.2 icons, they are not suitable for RTG systems, to improve them, see my screenshot, you have to restore them and then create the Glow with icon Editor.

Important, the icons must have an outer size "the transparent one" large enough otherwise the Glow will look good.

Example an icon with image 44, must be included in a minimum icon of 48, the 4 transparent inches around the image will serve for the Glow, the larger the transparent space the better the quality of the glow will be

Last edited by AMIGASYSTEM; 31 May 2023 at 22:17.
AMIGASYSTEM is offline  
Old 31 May 2023, 20:37   #4193
pixie
Registered User
 
pixie's Avatar
 
Join Date: May 2020
Location: Figueira da Foz
Posts: 340
Quote:
Originally Posted by AMIGASYSTEM View Post
pixie, the icons you converted, do not have the same quality as the original ones, if you enlarge them you will notice stripes.
I've downscaled them, If I convert using the script there's no issues, the stripes you see is from WinUAE scanline filter being applied.

Quote:
Originally Posted by AMIGASYSTEM View Post
To do a good job, extract the images with icon editor !
That's what I did before... But I will try to see what more can it do beside convert images, you told about glow, I will also have to try it.

Quote:
Originally Posted by AMIGASYSTEM View Post
The OS 3.2 icons, they are not suitable for RTG systems, to improve them, see my screenshot, you have to restore them and then create the Glow with icon Editor.
They do not that's why I picked the bigger OS4 ones and downscaled. Beside the 2nd icon is more then glow being applied, usually it has also a little animation.
pixie is offline  
Old 31 May 2023, 23:49   #4194
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
Quote:
Originally Posted by pixie View Post
Well, you may have superseded yourself because if I choose the root folder it convert all the icons present!
For me it seems that you don't know what you're doing. I'm 100 % sure that my script can only handle 1 icon at a time. Maybe you are selecting multiple icons in a tool like DOpus4 or another file manager, and then have configured a button for launching my script, but also activated the option "With All Files". That, of course, would launch my script for every "single" file that you have selected again, but none of these script calls would process more than one icon at a time. So, tell me, what you are really doing that you can process all icons in a directory with just one click?

Quote:
Those which I want to convert are 64px wide, while it's good for 4k I prefer to have it in 1080p. 48px wide is about the dimension of os3.2 icons, ...
Look into your script again: the width is 48 pixels but the height is set to 49, maybe just a typo, but a bit unusual at least or why is it 49 and not 48?

Btw, I never had any such strange WinUAE screenshots with scanline filters. There is an option: "Take screenshots before filtering", but anyway, I don't have any filters activated on my system.
PeterK is offline  
Old 01 June 2023, 00:28   #4195
nikosidis
Registered User
 
Join Date: Jan 2020
Location: oslo/norway
Posts: 1,607
Thanks a lot for this icon.lib
Icons always been a mess on Amiga. Now they are not
I use this library now with A4000 and Rom 3.0 and use Remlib as adviced.
nikosidis is offline  
Old 01 June 2023, 08:39   #4196
pixie
Registered User
 
pixie's Avatar
 
Join Date: May 2020
Location: Figueira da Foz
Posts: 340
Quote:
Originally Posted by PeterK View Post
For me it seems that you don't know what you're doing.
That I am sure! xD

Quote:
Originally Posted by PeterK View Post
I'm 100 % sure that my script can only handle 1 icon at a time. Maybe you are selecting multiple icons in a tool like DOpus4 or another file manager, and then have configured a button for launching my script, but also activated the option "With All Files". That, of course, would launch my script for every "single" file that you have selected again, but none of these script calls would process more than one icon at a time. So, tell me, what you are really doing that you can process all icons in a directory with just one click?
I sent a video with what I do, I pick a folder, drop it, then it opens a file requester, I drop it again because it starts on on sys: by default, then it converts and I go to t:newstyle and here they are... it happens here on the appdrop but behaves the same if you use start it from the ConvertToPNG icon.

Edit: these newstyle icons seems to be the original ones

Quote:
Originally Posted by PeterK View Post
Look into your script again: the width is 48 pixels but the height is set to 49, maybe just a typo, but a bit unusual at least or why is it 49 and not 48?
I pick one png icon that of your demo disk and it was 64x65 and I assumed that all the others would be also, so I picked that ratio, because that was what photoshop presented me when I downscaled to 48px wide. (you can check in the annexed files)

I'll try -w 48 only, to see if it will scale proportionally.

Quote:
Originally Posted by PeterK View Post
Btw, I never had any such strange WinUAE screenshots with scanline filters. There is an option: "Take screenshots before filtering", but anyway, I don't have any filters activated on my system.
I use lightshot, it let me choose the area I want to take screenshot, it's a transversal app I use for everything.
Attached Images
  
Attached Files
File Type: rar videocapture.rar (852.7 KB, 25 views)

Last edited by pixie; 01 June 2023 at 08:58.
pixie is offline  
Old 01 June 2023, 14:03   #4197
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
Quote:
Originally Posted by pixie View Post
I sent a video with what I do, I pick a folder, drop it, then it opens a file requester, I drop it again because it starts on on sys: by default, then it converts and I go to t:newstyle and here they are... it happens here on the appdrop but behaves the same if you use start it from the ConvertToPNG icon.
Thanks for the video clip, it clarifies a lot. There seem to be some issues left with my script, that I have to care for, and some things which could be improved a bit:

1.) The drawer icon was not accepted by your DropView app-icon.
2.) If that fails (same with WB menu) then the file requester appears, which is intended.
3.) I should store the directory of the last access in the script to offer it instead of SYS:.
4.) The filerequester didn't check for a wrong selection (no icon was selected in Prefs) and didn't fail (it should also do that with multi-selection).
5.) Since the requester didn't fail, the Copy command in my script got the drawer Prefs as $file and thus copied the contents of Prefs to T:NewStyle, but none of these icons was processed by ImageConverter and updated with CopyIcon.
Quote:
Edit: these newstyle icons seems to be the original ones
PeterK is offline  
Old 03 June 2023, 22:01   #4198
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
Ok, now you can test my updated script ConvertToPngIcon for ImageConverter by Thilo Koehler and DropView by Steven Eckles or per Workbench Tool-Menu.

I hope, that I didn't add new bugs this time, but as always, I'm too lazy to check everything thoroughly.

Important: Please use this script only with my latest icon.library #576 or newer (attached at the first page of this thread). The Aminet version #575 and older libraries still have a transparency mask which causes jagged edges at the image borders. That bug has been fixed in #576.

Last edited by PeterK; 11 June 2023 at 02:31.
PeterK is offline  
Old 03 June 2023, 22:56   #4199
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
Seems to work just fine Peter! Thanks a lot (thankfully I remembered to comment the "replace icon" line near the end :P )
Dropview in general doesn't seem to work on my installation of 3.2.2.1 (it puts it's AppIcon and drag&dropping things work, but double-clicking it's appicon doesn't open the main window with an error code:2)

Thanks so much for your work man

Last edited by mfilos; 03 June 2023 at 23:13.
mfilos is offline  
Old 04 June 2023, 00:36   #4200
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,365
Quote:
Originally Posted by mfilos View Post
Seems to work just fine Peter! Thanks a lot (thankfully I remembered to comment the "replace icon" line near the end :P )
Dropview in general doesn't seem to work on my installation of 3.2.2.1 (it puts it's AppIcon and drag&dropping things work, but double-clicking it's appicon doesn't open the main window with an error code:2)

Thanks so much for your work man
Thanks for your feedback, Marios!

Please also have a look into the Readme about the DropView Error 2 or at this page: https://eab.abime.net/showpost.php?p...postcount=4157

It is not so important to open the Dropview GUI for editing the preferences, because when you save your settings it writes them back as tooltypes into the DropView icon (alias ConvertIcon.info for my script). So you can simply edit the tooltypes directly to change the settings without using the preferences GUI.

I've seen that you have parentheses problems with another script for icons by EctoOne. The same happens with my script if the filename contains the .bra = "(" and .ket = ")" characters which are used to replace the arguments of the script. Of course, you can change the definitions of .bra and .ket to something else like "<>" or "[]" or "{}" or whatever, but you will always find some argument strings or other reasons for getting conflicts for the argument assignments. Try to replace the .bra and .key values and the parenthesis in "(filename)", but other problems may arise soon. That's a general problem of scripts, I guess. Edit: This was not the reason for the problems with parentheses. That was caused by the List command, misunderstanding these characters as part of some pattern matching.

Last edited by PeterK; 06 June 2023 at 11:29.
PeterK is offline  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
ClassicWB Full and icon.library 46.4 Retroplay project.ClassicWB 8 05 August 2018 13:57
WB library conflict/versions Amiga1992 support.Apps 3 22 July 2010 18:47
PNG Icon to Color Icon Converter? Leandro Jardim request.Apps 1 24 May 2010 04:39
What's the latest version of icon.library for OS3.9? NovaCoder support.Apps 3 30 June 2009 15:43
Requesting icon.library v44+... nikvest request.Other 2 16 September 2007 01:58

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 16:27.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.15893 seconds with 14 queries