Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » GTK+
  • » could not display images using gtk_image_new_from_file [RSS Feed]

#1 March 17, 2008 14:00:49

Harinandan S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

could not display images using gtk_image_new_from_file


Hi All,

In my application i've

image=gtk_image_new_from_file("a.png");

If i run the application on windows i see only a broken image though the
file is present in the directory where the executable is present. I also
tried giving absolute path such as C:\ but still it doesn't display image.

Whereas if i use the same code in linux platform i am able to see the image.

I have GTK+ 2.12.2 and have installed libjpeg, libpng both on windows and
linux platforms.

What may be the reason that image is not being displayed?
--
Regards,
Harinandan S_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#2 March 17, 2008 14:58:25

Tor L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

could not display images using gtk_image_new_from_file


> In my application i've
> image=gtk_image_new_from_file("a.png");
>
> If i run the application on windows i see only a broken image though the
> file is present in the directory where the executable is present.

Well, it has to be in the current directory of the application, just
being in the directory where the executable is located isn't good
enough.

> I also tried giving absolute path such as C:\ but still it doesn't display
> image.

You did remember to use double backslashes like "C:\\a.png" ?

If it still didn't work, your GTK+ installation is probably mixed up,
and gdk-pixbuf can't find its loaders or something like that. How did
you install the GTK+ runtime, from what files or installers, from
where? Have you moved the DLLs around from where they were after
unzipping or installing? You shouldn't. You should keep the directory
structure intact. (You can remove unneeded stuff like the message
catalogs from share\locale (or lib\locale) or the pangoft2 DLL if you
don't need them.) You can move the whole GTK+ installation tree as a
whole, but don't move files around inside it.

--tml
_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#3 March 17, 2008 16:04:10

Harinandan S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

could not display images using gtk_image_new_from_file


Thanks a lot.

TL>On Mon, Mar 17, 2008 at 7:28 PM, Tor Lillqvist <> wrote:

> > In my application i've
> > image=gtk_image_new_from_file("a.png");
> >
> > If i run the application on windows i see only a broken image though the
> > file is present in the directory where the executable is present.
>
> TL>Well, it has to be in the current directory of the application, just
> TL>being in the directory where the executable is located isn't good
> TL>enough.


Yes. The image file was not in the current directory of the application,
thats why it was not being displayed.




>
>
> > I also tried giving absolute path such as C:\ but still it doesn't
> display image.
>
> TL>You did remember to use double backslashes like "C:\\a.png" ?
>

Thanks. I had given a single slash so it was not coming up.


>
>
> TL>If it still didn't work, your GTK+ installation is probably mixed up,
> TL>and gdk-pixbuf can't find its loaders or something like that. How did
> TL>you install the GTK+ runtime, from what files or installers, from
> TL>where? Have you moved the DLLs around from where they were after
> TL>unzipping or installing? You shouldn't. You should keep the directory
> TL>structure intact. (You can remove unneeded stuff like the message
> TL>catalogs from share\locale (or lib\locale) or the pangoft2 DLL if you
> TL>don't need them.) You can move the whole GTK+ installation tree as a
> TL>whole, but don't move files around inside it.




>
> --tml
>

--
Regards,
Harinandan S_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

  • Root
  • » GTK+
  • » could not display images using gtk_image_new_from_file [RSS Feed]

Board footer

Moderator control

Enjoy the 11th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support