Zim

support for .eps grafics - ?feature request

Bug #964305 reported by Max
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Zim
Confirmed
Wishlist
Unassigned

Bug Description

I'm running zim 0.55 under Linux. When I'm trying to insert the eps file I receive the following error: "File type not supported: image/x-eps". Dragging the image onto the page creates a place-holder for the image and exporting such a page with the placeholder with Latex works fine.

Is there a workaround to insert the .eps files onto the page? It would be a highly desirable feature for me, as I have all the figures in that format. If for some reasons it's hard to implement right now, maybe it is possible to insert a link to such a file, which would be later on understood by latex? Smth like <image.eps>.

Thank you,
Max

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote : Re: [Bug 964305] [NEW] support for .eps grafics - ?feature request

Can not support eps natively since it is (apparently) not supported by
Gtk. Placeholder is a smart idea. Would probably be a plugin that
inserts an object, which has export for latex. Object could even show
a preview (e.g. convert image to png, show png in zim, but use eps for
latex source).

-- Jaap

On Sun, Mar 25, 2012 at 4:51 AM, Max <email address hidden> wrote:
> Public bug reported:
>
> I'm running zim 0.55 under Linux. When I'm trying to insert the eps file
> I receive the following error: "File type not supported: image/x-eps".
> Dragging the image onto the page creates a place-holder for the image
> and exporting such a page with the placeholder with Latex works fine.
>
> Is there a workaround to insert the .eps files onto the page? It would
> be a highly desirable feature for me, as I have all the figures in that
> format. If for some reasons it's hard to implement right now, maybe it
> is possible to insert a link to such a file, which would be later on
> understood by latex? Smth like <image.eps>.
>
> Thank you,
> Max
>
> ** Affects: zim
>     Importance: Undecided
>         Status: New
>
> --
> You received this bug notification because you are subscribed to Zim.
> https://bugs.launchpad.net/bugs/964305
>
> Title:
>  support for .eps grafics - ?feature request
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/zim/+bug/964305/+subscriptions

Revision history for this message
Max (nikitchmpublic) wrote :

So, you think the whole problem is in Gtk, and if they start supporting .eps images, zim will support them as well automatically?

The .png preview is a great idea! Actually it doesn't have to modify the text source. As you suggested when the .eps image is requested to be inserting onto the page the plugin could take the original .eps, convert it, e.g., into a small .png, and place it into the corresponding folder. Then whenever the .eps reference is encountered in the document the plugin (or zim) would try to show the .png file in the folder before reporting the error.

What does it take to write such a plugin?

Thanks,
Max

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote : Re: [Bug 964305] Re: support for .eps grafics - ?feature request

On Mon, Mar 26, 2012 at 12:39 AM, Max <email address hidden> wrote:
> What does it take to write such a plugin?

Could probably use the "image generator" framework. This is what is
used e.g. by the latex equation editor.

1/ Add a dialog "insert EPS", which selects the file, generates the
corresponding PNG and inserts it
2/ Attach a type to the image so it is understood as a "generated" image
3/ Custom "edit" dialog, probably just allow to select a different
EPS, so re-use selection dialog

Currently the latex exporter has hard coded that equations are
inlined. For now we can also hardcode similar support for EPS. Will
work on more general solution later.

-- Jaap

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Attached a boiler plate for the plugin. Untested, so may need some
further editing.

Adds a menu item for "insert EPS", allows to select a file.
PNG is generated in same folder with same name (existing png with same
name will be overwritten !).

Please check the command used to convert EPS to PNG. Copied a
suggestion from the internet using image magick, maybe there is a
better command to do this ?

Additional patch needed to fix latex export. Now it will just include the png.

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :
  • latex.py Edit (6.8 KiB, application/octet-stream; name="latex.py")

On Mon, Mar 26, 2012 at 11:19 AM, Jaap Karssenberg
<email address hidden> wrote:
> Additional patch needed to fix latex export. Now it will just include the png.

Drop in replacement for latex module on version 0.55 - untested as well.

-- Jaap

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Please let me know if you tested this work around. If it is OK I'll try to merge in the main source.

Changed in zim:
status: New → Confirmed
importance: Undecided → Wishlist
Revision history for this message
Max (nikitchmpublic) wrote :

I apologise, but I couldn't test it yet - got too much on my plate right now. And it would certainly be great if you merged it in the main source. Thank you.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.