Thread: Embedding png files

  1. #1
    Registered User
    Join Date
    Feb 2024
    Posts
    3

    Embedding png files

    Does anybody have any advice for embedding png files using gtk? I used xxd to convert all the .png images into .h files, but I can't get them to show up right with gdk_pixbuf_new_from_data.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    GdkPixbuf.Pixbuf.new_from_bytes
    Currently only RGB images with 8 bits per sample are supported.
    You need to filter your png files through say imagemagik to get just the raw RGB data.
    A close example:
    imagemagick convert png 16 bit to raw - Stack Overflow

    If you want GTK to handle all the PNG headers and compression, you need to use say new_from_file
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Font Embedding to TextBox
    By xwielder in forum C# Programming
    Replies: 3
    Last Post: 04-28-2012, 01:25 AM
  2. Python Embedding Help...
    By Rendered in forum C Programming
    Replies: 2
    Last Post: 11-17-2007, 10:08 AM
  3. embedding web pages
    By Devil Panther in forum Windows Programming
    Replies: 9
    Last Post: 01-14-2005, 09:37 AM
  4. Embedding a control in a CListView
    By Drewpee in forum Windows Programming
    Replies: 1
    Last Post: 09-19-2001, 04:12 PM

Tags for this Thread