Help converting SVG icon to Haiku (Icon-o-matic)

Hi. I’ve asked a friend to create an SVG icon for me for my video editor, but the SVG file cannot be opened properly with Icon-o-matic. I know nothing about SVG images, I’ve tried converting the icon with Inkscape, but it’s still not parsable by Icon-o-matic.

Is there anyone in the community who can help me convert the attached SVG icon to a Haiku .rsrc or .rdef file.

http://www.users.on.net/~zenja/Medo_Icon.svg

Thanks.

seem your icon too complicated… CMIIW

Have tried to create a own one? Here some tips:

http://besly.de/index.php/en/painting/icon-o-matic/creating-a-simple-icon
http://besly.de/index.php/en/painting/icon-o-matic/icon-o-matic-tips-and-tricks
http://besly.de/index.php/en/painting/icon-o-matic/how-to-add-a-icon-to-a-binary

Icon-O-Matic has some “arbitrary” limits on the number of shapes and paths you can have (this is to make sure the icon data remains small and can be stored in the “small attribute” section of the filesystem inode, making it loadable without extra hard disk seeks). You are possibly hitting some of these if the icon is not optimized enough, or maybe using some SVG features that Icon-O-Matic cannot handle.

I guess the IOM svg parser doesn’t understand CSS style, the shapes are parsed but everything is black, as the file exported to HVIF gets nice big I cleaned it up and simplified it, if you don’t mind having the original graphics but you are fine even a highly optimized file (the attribute only weighs 629 bytes), this is what I did
MEDO
https://filebin.net/p1wudrxhdg1zfasw

8 Likes

resource vector_icon array {
	$"6E63696607050004005C020106023DC0000000000000003DC0004A0000420000"
	$"00FF808FFFFF173F020106023D00000000000000003C80004A0000490000C7FF"
	$"FFFFFFD2FAF6020106023A00000000000000003A00004A00004A000000B3FFD8"
	$"FF03A151020106023A00000000000000003A00004A900047C00000ACE6FFFF05"
	$"94D0020106023A00000000000000003A000049000047C00000FFC7D0FFFF1B41"
	$"100A042727592759592759020C283C284628392A3529372634242D243124282D"
	$"2429243124362C3627392B402A3D2A432A4A2C472B4A2752244E2457245B2D5B"
	$"285B31553559345637573C57395746404F4D4F334F020E523C523A5244404A4A"
	$"4A364A2D3C2D442D3A2F352F352C342A2F2A322A2C30292D293229352D352A35"
	$"2D37303730392F402E3D2E432E4930472F49304B2D4B2D4B2A50294E29C77729"
	$"552F552C553251355434513508023D4A3C4E0802354C374908022F4832460A02"
	$"2B432F410802293B2E3B08022B352F350802252F2A30080227282C2B08022E25"
	$"312908023C2E3B2B0204BC5D2FBDCB2FBAEE2F31BB9131BA2231BCFFBC5D3CBA"
	$"EE3CBDCB3C3EBB913EBCFF3EBA220A0443304E304E3B433B0A0339414741404B"
	$"0E0A0001001001178E02040A0201001001158A02040A0101012020240A000101"
	$"000A0301011001157E00040A0001021001178100040A000A080403090A0B0706"
	$"050C1001178100040A000A080403090A0B0706050C12C010D600000000000040"
	$"00004BFEAF00000001178100040A00010D1001178200040A06010D000A00010E"
	$"1001178402040A05010E1001158202040A00010F1001178422040A04010F1001"
	$"15820204"
};
3 Likes

You guys are wonderful !!!

Thanka a lot zuMi.

2 Likes

A few NOTES on Haiku Icon development:

  • HVIF-based icons and HVIF Rdef - “As you can see, you wouldn’t really want to use HVIF to store generic vector graphics. It is really a format that is suited for a very special task only. But as was said before, it will turn out to be beneficial, ultimately in terms of desktop responsiveness. This won’t come automatically though. If icons are designed without knowledge of how HVIF works, then a lot of potential is wasted. For example, if vector path points are not snapped to integer pixels or if paths are not reused where they could be, then an icon can take much more space than it should. This is especially true if an SVG icon is imported into Icon-O-Matic and simply saved to HVIF as is. This is not such a good idea.

Some users are doing SVG->HVIF with import issues, so I’m referencing the warning message. HVIF has a icon limitation of 256 vector paths - so keep a vector icon’s vector path count (and style count) less than 256 - for SVG importing using Icon-o-Matic).

Note: I-O-M’s canvas is 64x64 pixels (limit of 1,024 pixels).

Can you explain to me how I can add a raster icon?
I tried with

 addattr -f path_of_raster_file -t icon BEOS:ICON path_of_file

The raw data is added but nothing is shown, I tried with BEOS:L:STD_ICON attribute but it’s the same, I thought it can show only bbitmap cmap8 but there is not a translator for it, how can I achieve that?

It’s not a BBitmap, but just the raw bytes of a 32x32 bitmap (exactly 1024 bytes), and no, there’s no translator for that. Your command seems correct so I guess the problem is in generating the data to feed to it?

yes, ‘translate’ can export to ‘bits’ but it’s a B_RGBA32, so there is no way to convert to B_CMPA8, at least from cli