Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old December 20th, 2006   #1
Gen2ly
Dark Roasted Ubuntu
 
Gen2ly's Avatar
 
Join Date: Nov 2006
Location: There and back again
Beans: 1,061
Windows Icons to Linux (converting)

This is an Update, I preserved the original below.

I found a much better method to make your Icons on Windows available on your Linux Box, and easier too. The prior method would disguise the .ico file as a .png, completely ignoring multiple layers hidden therein. This also made the .png impossible to edit in gimp. Well, I stumbled upon a much better way to have your icons converted. First we'll need icoutils.

Code:
sudo apt-get install icoutils
Icoutils contains four programs, the two most likely you'll use though are wrestool and icotool. Whatis reveals what these programs do
icotool (1) - Convert and create Win32 icon and cursor files
wrestool (1) - extract resources from Microsoft Windows(R) binaries (exe's and dlls) I assume ``extresso'' automates these tasks with the help of special resource scripts.
You can use icotool to see what types of icons are available in an .ico file:

Code:
icotool -l Emoticon.ico
You'll see a list like this:

Code:
--icon --index=1 --width=32 --height=32 --bit-depth=8 --palette-size=256
--icon --index=2 --width=16 --height=16 --bit-depth=8 --palette-size=256
--icon --index=3 --width=128 --height=128 --bit-depth=32 --palette-size=0
--icon --index=4 --width=48 --height=48 --bit-depth=32 --palette-size=0
--icon --index=5 --width=32 --height=32 --bit-depth=32 --palette-size=0
--icon --index=6 --width=16 --height=16 --bit-depth=32 --palette-size=0
In this case it showed six different sizes, I believe this is standard for XP (and Vista??).

If you want to extract all the icons in the .ico file and converts them to .png:

Code:
icotool -x -o . BootCamp_Drive.ico
This will extract the six icons listed above in Emoticon.ico. -x signifies extract while -o directs icotool to an output directory, in this case "." or the same directory.

You will notice that the eight bit depth icons won't carry a proper alpha layer and have a black layer about them. You probably won't need the eight bit depth icons and they dont' need to be extracted. To extract an entire directory ignoring eight bit icons cd into it and just do:

Code:
icotool -x --palette-size=0 -o /home/user/Desktop/seperate-directory *.ico
Ignoring the 256 colored (eight bit) icons, use the palette size of 0 to specify 24 bit and 32 bit. You also noticed it isn't a bad idea to use a separate output directory.

Thats is. Enjoy!

Manual Icon Conversion

This was the first way I did it, and it works nice, albeit it is a dirty method. There were no resources that I could locate so I pretty much learned this from scratch.

I had heard ImageMagik could do this but the program convert gave me a don't understand (.) argument. Anyways. Next, I heard Gimp would be perfect for such a little task. So, I tried to learn how to do batch jobs. I'm sorry, but the documentation I saw, just overwhelmed me. Doing batch jobs in Gimp take a pretty experienced person.

So I was just messin' about and decided to change .ico to .png. OMG, it worked!

That's all I had to do! The mask and everything was kept. Now, of course, this isn't the best method if you have hundreds of icons you need converted. So I tried 'mv *.ico *.png'. This to my surprise didn't work. I learned that to do mass renaming like this takes quite a bit more programming knowledge. Well, to cut this short. I made a script that first takes spaces out of the icons names and replaced them with underscores, then added the change name extension. Goto the icon Folder (e.g. cd ~/Desktop/Frosty-Icons) then use the script. You have to use for the script for all the folders, but it will save you a lot of time. Just cut/paste into the terminal.
Code:
for i in *\ *
do
mv "$i" `echo "$i" | tr ' '  '_'`
done
for i in *.ico
do
  j=${i%.ico}.png
  # or: j=${i}l
  mv $i $j
done
Note: Windows .ico's use multiple layers, and png's don't, so opening these files up in Gimp isn't possible unless (of course) you rename the extension back.

Last edited by Gen2ly; May 22nd, 2007 at 06:27 AM..
Gen2ly is offline   Reply With Quote
Old December 20th, 2006   #2
aysiu
HP Mini 1120nr User
 
aysiu's Avatar
 
Join Date: May 2005
Location: US
My beans are hidden!
Ubuntu 9.10 Karmic Koala
Re: Windows Icons to Linux (converting)

If you don't mind using a graphical tool, you can do mass-renaming with krename, which is in the Universe repositories.
__________________
tutorials | blog |
advice | more advice
aysiu is online now   Reply With Quote
Old December 21st, 2006   #3
DarkN00b
Dipped in Ubuntu
 
DarkN00b's Avatar
 
Join Date: Aug 2006
Location: East Texas
Beans: 610
Ubuntu 8.04 Hardy Heron
Re: Windows Icons to Linux (converting)

You could use XNview to select a whole directory and batch convert them all to .png .
DarkN00b is offline   Reply With Quote
Old December 21st, 2006   #4
~LoKe
Chocolate Ubuntu Mocha Blend
 
~LoKe's Avatar
 
Join Date: Dec 2005
Location: London, Ontario, Canada.
Beans: 1,837
Ubuntu Karmic Koala (testing)
Send a message via AIM to ~LoKe Send a message via MSN to ~LoKe
Re: Windows Icons to Linux (converting)

Don't you need a config file to turn these icons into a theme? Shame there's nothing that'll do that for you.
~LoKe is offline   Reply With Quote
Old December 24th, 2006   #5
bodhi.zazen
Ubuntu Guru
 
bodhi.zazen's Avatar
 
Join Date: Apr 2006
Location: Montana
My beans are hidden!
Xubuntu Development Release
Send a message via Yahoo to bodhi.zazen
Re: Windows Icons to Linux (converting)

Nice How-to

This thread has been added to the UDSF wiki.

Convert_Windows_icons
__________________
A person with ubuntu is open and available to others, affirming of others, does not feel threatened that others are able and good, for he or she has a proper self-assurance that comes from knowing that he or she belongs in a greater whole and is diminished when others are humiliated or diminished, when others are tortured or oppressed. ~ Archbishop Desmond Tutu, 1999

bodhi.zazen is offline   Reply With Quote
Old December 24th, 2006   #6
sebbe1991
5 Cups of Ubuntu
 
Join Date: Jun 2006
Location: Sweden
Beans: 26
Re: Windows Icons to Linux (converting)

extract .ico from .icl .dll .exe
Code:
wrestool -x --output=. -t14
convert .ico to .png
Code:
for i in *.ico; do convert "$i" "$i.png"; done
sebbe1991 is offline   Reply With Quote
Old March 26th, 2007   #7
David Floyd
Just Give Me the Beans!
 
Join Date: Dec 2006
Location: Bristol, UK
Beans: 66
Ubuntu 7.04 Feisty Fawn
Re: Windows Icons to Linux (converting)

Quote:
Originally Posted by sebbe1991 View Post
extract .ico from .icl .dll .exe
Code:
wrestool -x --output=. -t14
The above code did not work for me - what am a missing?

I get the following error: wrestool: command not found

Thanks for help,

David
David Floyd is offline   Reply With Quote
Old March 28th, 2007   #8
chinaski
Gee! These Aren't Roasted!
 
chinaski's Avatar
 
Join Date: Sep 2005
Location: Parma, Italy
Beans: 166
Ubuntu 9.10 Karmic Koala
Re: Windows Icons to Linux (converting)

@ Dirk.R.Gently:

thanks a lot this how-to is very useful
__________________
... who never laughs is not a serious person ...
chinaski is offline   Reply With Quote
Old March 28th, 2007   #9
David Floyd
Just Give Me the Beans!
 
Join Date: Dec 2006
Location: Bristol, UK
Beans: 66
Ubuntu 7.04 Feisty Fawn
Re: Windows Icons to Linux (converting)

Quote:
Originally Posted by chinaski View Post
@ Dirk.R.Gently:

thanks a lot this how-to is very useful
So, did you get the code:

wrestool -x --output=. -t14

to work?

I got the error message :

wrestool: command not found

and I don't know how to proceed from there.

David
David Floyd is offline   Reply With Quote
Old March 28th, 2007   #10
chinaski
Gee! These Aren't Roasted!
 
chinaski's Avatar
 
Join Date: Sep 2005
Location: Parma, Italy
Beans: 166
Ubuntu 9.10 Karmic Koala
Re: Windows Icons to Linux (converting)

no sorry,

I am using this metod

Code:
for i in *\ *
do
mv "$i" `echo "$i" | tr ' ' '_'`
done
for i in *.ico
do
j=${i%.ico}.png
# or: j=${i}l
mv $i $j
done
described in first post
__________________
... who never laughs is not a serious person ...
chinaski is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

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 -4. The time now is 02:00 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry