Jump to content

Search the Community

Showing results for tags 'icns'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. hi to all. I've been beating my head against the wall for a couple of days now trying to save a image as a valid ICNS file ( ICNS is the icon format for Mac OS ). Let's say I have a image of 128 x 128. I've managed to get the color and opacity for each pixel but I'm not really sure how the ICNS file format wants this data compressed. I found some pseudo-code but i can't figure out from that what I have to do: http://www.macdisk.com/maciconen.php3#RLE More info about icns file can be found on wiki: http://en.wikipedia.org/wiki/Apple_Icon_Image Does anybody have any good ideeas about this ? As wiki says, ( for example ) the 128 x 128 icns file should have the header it32, the 48x48 ih32, the 32x32 - il32 and the 16x16 - is32 $im = imagecreatefrompng("128.png"); $width = imagesx( $im ); $height = imagesy( $im ); $pixel_data = array(); $opacity_data = array(); $current_opacity_val = 0; for ( $y = $height - 1; $y >= 0; $y-- ) { for ( $x = 0; $x < $width; $x++ ) { $color = imagecolorat( $im, $x, $y ); $alpha = ( $color & 0x7F000000 ) >> 24; $alpha = ( 1 - ( $alpha / 127 ) ) * 255; $color &= 0xFFFFFF; $color |= 0xFF000000 & ( $alpha << 24 ); $pixel_data[] = $color; $opacity = ( $alpha <= 127 ) ? 1 : 0; $current_opacity_val = ( $current_opacity_val << 1 ) | $opacity; if ( ( ( $x + 1 ) % 32 ) == 0 ) { $opacity_data[] = $current_opacity_val; $current_opacity_val = 0; } } if ( ( $x % 32 ) > 0 ) { while ( ( $x++ % 32 ) > 0 ) $current_opacity_val = $current_opacity_val << 1; $opacity_data[] = $current_opacity_val; $current_opacity_val = 0; } } Thanks in advance for any help you can offer.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.