Re: [Gimp-developer] open thumbnail and raw files

2004-11-21 Thread Joseph Heled
Hi,
In most raw files the thumbnail exists as an embedded jpeg. I know how to read 
it to memory, but need advice on how to load it into gimp (i.e. create a valid 
image ID for it).

Option a) Perhaps such functionality already exists - but I did not find it?
Option b) Go through the file system - write a temporary file and load it via a 
PDB call.

Option c) Use some jpeg library (say libjpeg) to read it.
(b) is the probably the simplest, but I am not happy about going to the file 
system and all the issues it brings. On the other hand (c) is quite complicated.

Can someone make a suggestion?
Thanks, Joseph
Sven Neumann wrote:
Hi,
a while ago Joseph Heled [EMAIL PROTECTED] wrote:

The gimp Open Image dialog contains preview thumbnail. To generate
them, gimp calls the plugin to generate them. Now, for raw digital
camera files (.nef, .crw ...) this is a very expensive operation - and
obviously one would love to use the prepared/pre-stored thumbnail
which exists in the file.
From what I could see, there is no way I (the plugin author) can
detect if the call is for a thumbnail or not.

Note that I have just added the missing API for plug-ins and also
implemented the core functionality. What's missing now is some more
plug-ins using this feature. See also
  http://bugzilla.gnome.org/show_bug.cgi?id=158190
  http://bugzilla.gnome.org/show_bug.cgi?id=158191
  http://bugzilla.gnome.org/show_bug.cgi?id=158192
  http://bugzilla.gnome.org/show_bug.cgi?id=158193
Sven

___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer


Re: [Gimp-developer] open thumbnail and raw files

2004-11-21 Thread Adam D. Moss
Joseph Heled wrote:
Option b) Go through the file system - write a temporary file and load 
it via a PDB call.
(b) is the probably the simplest, but I am not happy about going to the 
file system and all the issues it brings.
I wouldn't be too shy about it.  The jpeg plugin itself (last
I saw) does a similar thing when in 'preview' mode.  Whatever
works!
--Adam
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer


Re: [Gimp-developer] open thumbnail and raw files

2004-11-21 Thread Sven Neumann
Hi,

Joseph Heled [EMAIL PROTECTED] writes:

 After some more digging, I think I will use gdk_pixbuf_loader

Yes, why not. Seems reasonable since you can probably assume that the
embedded thumbnail won't be too large.


Sven

___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer


Re: [Gimp-developer] open thumbnail and raw files

2004-11-13 Thread Sven Neumann
Hi,

a while ago Joseph Heled [EMAIL PROTECTED] wrote:

 The gimp Open Image dialog contains preview thumbnail. To generate
 them, gimp calls the plugin to generate them. Now, for raw digital
 camera files (.nef, .crw ...) this is a very expensive operation - and
 obviously one would love to use the prepared/pre-stored thumbnail
 which exists in the file.

  From what I could see, there is no way I (the plugin author) can
  detect if the call is for a thumbnail or not.

Note that I have just added the missing API for plug-ins and also
implemented the core functionality. What's missing now is some more
plug-ins using this feature. See also

  http://bugzilla.gnome.org/show_bug.cgi?id=158190
  http://bugzilla.gnome.org/show_bug.cgi?id=158191
  http://bugzilla.gnome.org/show_bug.cgi?id=158192
  http://bugzilla.gnome.org/show_bug.cgi?id=158193


Sven
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer


Re: [Gimp-developer] open thumbnail and raw files

2004-11-04 Thread Sven Neumann
Hi,

Joseph Heled [EMAIL PROTECTED] writes:

 This affect only load plugins with 4 declared arguments (by the
 plugin), the forth named thumbnail.

static GimpParamDef load_args[] =
  {
{ GIMP_PDB_INT32,  run_mode, Interactive, non-interactive },
{ GIMP_PDB_STRING, filename, The name of the file to load },
{ GIMP_PDB_STRING, raw_filename, URI of the file to load },
{ GIMP_PDB_INT32,  thumbnail,use embedded thumbnail },


That would break all load plug-ins that already have = 4 parameters
which is certainly not an option. Also, your proposal doesn't pass a
preferred thumbnail size to the load plug-in. There are file formats
that include thumbnails for several sizes or can generate thumbnails
of any size on the fly.

Let me explain it again: What we need here is a way for load plug-ins
to register an additional procedure that the core can use to load the
thumbnail. The core can then check if such a procedure exists and fall
back to the default load procedure otherwise.


Sven
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer


Re: [Gimp-developer] open thumbnail and raw files

2004-11-03 Thread Joseph Heled

Sven Neumann wrote:
Hi,
Joseph Heled [EMAIL PROTECTED] writes:

The gimp Open Image dialog contains preview thumbnail. To generate
them, gimp calls the plugin to generate them. Now, for raw digital
camera files (.nef, .crw ...) this is a very expensive operation - and
obviously one would love to use the prepared/pre-stored thumbnail
which exists in the file.
From what I could see, there is no way I (the plugin author) can
detect if the call is for a thumbnail or not.
Can someone tell me if I am right or wrong?
If wrong - how do I do it?
If right, is there a chance this can be changed?

You are right. You could suggest an API and we could consider to add
it for GIMP 2.4.
The most natural place is to add an optional argument to the run() gimp
arguments. However I am not sure if this is possible. The plugin is a file
loader, registered under Load
gimp_install_procedure (file_rawphoto_load,
  ...,
  PLUG_IN_VERSION,
  Load/rawphoto,
I guess Load implies some magic, since it is not visible in the regular menus.
And perhaps 3 arguments is hardwired for such plugins? Can someone enlighten me?
(P.S it would certainly make sense to run this plugin non interactively from a
script, and in that case supply even additional arguments ...)
-Joseph

Sven

___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer


Re: [Gimp-developer] open thumbnail and raw files

2004-11-03 Thread Sven Neumann
Hi,

Joseph Heled [EMAIL PROTECTED] writes:

 The most natural place is to add an optional argument to the run()
 gimp arguments. However I am not sure if this is possible.

The plug-in interface must remain API and ABI compatible to GIMP 2.0
so changing any of the existing functions is not an option.

 The plugin is a file loader, registered under Load

 gimp_install_procedure (file_rawphoto_load,
 ...,
 PLUG_IN_VERSION,
 Load/rawphoto,

 I guess Load implies some magic, since it is not visible in the
 regular menus. And perhaps 3 arguments is hardwired for such plugins?
 Can someone enlighten me?

The Load menu is a concept that isn't used in 2.2 any longer. Please
have a look at how file plug-ins register in GIMP 2.2. The new API is
backward compatible with the old one of course. But it doesn't really
make sense to look at the old APIs if we want to discuss further
enhancements.

 (P.S it would certainly make sense to run this plugin non
 interactively from a script, and in that case supply even additional
 arguments ...)

There's nothing that keeps you from doing that. If you are looking for
an example, check out the SVG loader plug-in.


Sven
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer


Re: [Gimp-developer] open thumbnail and raw files

2004-11-03 Thread Joseph Heled

Sven Neumann wrote:
Hi,
Joseph Heled [EMAIL PROTECTED] writes:

Great. So what I suggest - i.e. a forth argument to run() to indicate
a request for a thumbnail should work and not break other plugins?
I think you need to make yourself familiar with the GIMP API. Did
you
ever look at the API reference manual?
Not in full, but I can't see why it will help, since this is internal
to gimp itself.

No it isn't. If I understand your approach, you suggested to add
parameters to run() 
Not at all. I meant to add a parameter to 'param'
run(const gchar* name,
gint nparams,
const GimpParam* param,
...)
This affect only load plugins with 4 declared arguments (by the plugin), the 
forth named thumbnail.

  static GimpParamDef load_args[] =
{
  { GIMP_PDB_INT32,  run_mode, Interactive, non-interactive },
  { GIMP_PDB_STRING, filename, The name of the file to load },
  { GIMP_PDB_STRING, raw_filename, URI of the file to load },
  { GIMP_PDB_INT32,  thumbnail,use embedded thumbnail },
(I would need to be superman to make a working change to run() in 15 minutes ... :)
-Joseph
even though run() of course has a fixed set of
parameters. Since it is probably the most important function in the
GIMP API and implemented by all plug-ins, there is certainly not an
option to change it. What we need here is a way for load plug-ins to
register and additional procedure to load the thumbnail. This could
probably be designed in a way that would allow plug-ins to reuse their
main procedure.
I am however not going to continue this discussion in private mail. If
you want to talk about it, please use the mailing-list.
No problem. I thought it is best not to inflict my ignorance on the whole list.
Sven

___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer