Inkscape screws up EPS files - latex

I have been trying to use Inkscape to prepare artwork graphics for my scientific papers. I use LaTeX, and I need my figures to be prepared as high-quality Encapsulated PostScript (EPS) images. The work order is as follows. First, I plot parts of my figure using matplotlib and save them in EPS format. Second, I launch Inkscape and import the EPS files. Using Inkscape I compose a figure, leaving needed objects, killing unneeded, and adding some markups. So I used to do when I worked with CorelDraw in Windows, but now I work in Linux.
Unfortunately, Inkscape damages EPS files: it changes the colors and does not save all the objects. Over last years I tried to search for a solution, but I cannot find that people complained. The complaints (found on the Web) are related to something like "incorrect font rendering" when exporting from svg to eps or back. (For me this is not a problem - the text always can be represented as curves).
I currently work in Mandriva Linux 2010 and use Inkscape version 0.47 r22583 (Jan 14 2010). Somewhere I read that such problems could be caused by some outdated versions of cairo - mine is 1.9.14. I spend a lot of effort to build newer cairo (1.12.14), but I am still far from the purpose. I got confused in 32 and 64-bit libraries coexisting in my system...
I would be very grateful to anyone who has similar problems and, may be, advanced further towards the solution. Let me illustrate the problem.
Sorry, I do not have enough reputation points to neither post images nor insert more than 2 links, so, please take a look at the copy of this post with the images in my livejournal page:
http://benkev.livejournal.com/1093.html
The figure captions are below.
(1) Here are the three eps images I would like to combine in one figure:
(2) Here is what I get after importing the images in Inkscape and saving in SVG format. Note color and resolution distortion. Also, I draw three red circles around the feature of interest.
(3) Here is what I get when I export this figure to EPS file. One can notice that one of the three red circles gone: only two circles left!
Thank you!

This appears to be a bug in inkscape. The following steps might help:
Open the svg file in inkscape.
Select all (Ctrl+A)
Un-group (Ctrl+Shift+G). you may need to repeat this step several times.
Save the result as eps format.

For what it's worth after more than one year: I've been experiencing the same problems with Inkscape V0.48: the EPS was missing items when opened in other software (e.g. Latex).
I didn't completely solve the problem, but I found that it helped to remove groups. Simply select all components and keep ungrouping until there are no groups left. Save as EPS and the result should be better.
If there are still items missing, try to use 'raise selection up to top' on the missing items and save again.

I know this is old, but the bug is still present in Inkscape so here's my two cents. My workaround is to save a copy of my project as "Plain svg". And export that as eps.
I hope it helps!

I created a new layer and moved the text which was not showing up in the EPS to this layer. Then it was showing up in the exported EPS file.
P.S. Make sure you make the new layer below the current layer and move text there.

It is a bug in inkscape (0.91 Window) but easy fix. Save directly into pdf from inkscape and then from pdf file save as to eps. Work like a charm for me.

A permanent solution for this problem is to export your *SVG to a *PNG and then export the *PNG (e. g. via the free Software GIMP) as an *EPS file type. The missing items are always included when I use this approach.

Related

How to convert jpg or png to svg in iOS?

I like to convert an .jpg or .png file to an .svg format that can be displayed in UIImageView. Is there a way to do this in Objective-C?
You shouldn't use SVG images in Xcode:
it is recommended that you use PNG or JPEG files for most images in your app. Image objects are optimized for reading and displaying both formats, and those formats offer better performance than most other image formats. Because the PNG format is lossless, it is especially recommended for the images you use in your app’s interface.
Also, there's an SVGKit that according to many devs is buggy so use it at your own risk.
SVG is an XML-based vector and in Xcode you can also use vectors but using a PDF format and follow this tutorial.
In a nutshell:
Generate PDFs With the #1x Asset (During compile time it will generate #2 and #3)
Set the Scale Factors to Single Vector:
Drag and Drop Your PDF Into the All, Universal Section
Refer to Your Image by Its Name, Like for any PNG File
[UIImage imageNamed:#”Home”]
Also, stackoverflow (perhaps) related answer
To convert PNG to SVG (Which is a very sensible and valid thing to do) you need an app or library called a "tracer". It will trace the outlines of shapes, gradients, etc and convert them into vector representations.
For simple cases, this is easy for a computer to do; for complex cases (e.g. gradients), this is a very hard AI / Computer-Vision problem and you'd need to spend $$$ on high-end coding solutions and/or find PhD-level research that solves the problem!
A free tracer that does a very good job is built-in to Inkscape (open-source) - google "inkscape trace" for tutorials on how to use it, and to generate a .svg file that you can use. This is a manual process.
To use this in-app, you need to find a tracing library for iOS. The libraries that Inkscape uses are all open-source, so you could try converting them to iOS - they're written in C, so it could be quite easy.

Photoshop Layer Style to CoreGraphics Code

Is there a way to easily export layer styles, created in photoshop, to core graphics code? Maybe a photoshop plugin or a .psd parser for use in xcode. I imagine someone has made (or should make) a process to more easily facilitate the "from design, to code" process. The only thing I could find on google was Opacity which takes illustrator files and outputs core graphics code.
Or maybe a third party program similar to this which creates a familiar layer style interface and exports css code.
Update : Found this today. MooMaskedIconView
Found it : http://www.paintcodeapp.com/
If you just want to apply effects to an image, you can use Core Image, which comes with 48 filters. Currently there isn’t a way to build custom filters on the iOS platform, that's a drawback … But to get started I sugesst you to take a look at Ray Wenderlichs tutorial Beginning Core Image in iOS 5 Tutorial.
Another approach is using 3rd party libs. For example ImageMagick, which has a huge feature set :)
I use Save for Web & Devices. Png-24 keep the opacity but there is no facilities for layers. When you save, the LNG becomes what you are looking at. So it's easy to keep several layers in the same Photoshop file.

Import DirectX .X into Blender

I spent some time now to find "tools" to work and make 3D applications with. For some reason I will use XNA 4.0. This can import .X or .FBX files for models - perhaps many more, but I do not know of this yet. Both format I want to use as text-based, not binary. I found .X making less trash text so I tried to look for free, but useful tool to edit .X files. After many downloaded trash software I found Blender to be "just fine" for my needs.
My problem was that even if Blender can export to .X and even .FBX, it can not import from these formats. I was looking for plugin for this goal, but none I have found so far, and after too many "visited links" I just lost the line, so I thought I will ask around here, if anyone knows a good way to import .X into Blender...
or
make XNA work with other formats.
suggest a good 3d editing program, that can edit models imported from .X or .FBX (text) and can export into one of these formats.
I used search, and am not retarded - just tried of looking-and-looking.. so.. any good idea or link is welcome. Thanks in advance.
Edit: to make it clear: my goal is to have a 3d modell editor, that can be used to edit .X (or .FBX) in text format, so I can work with XNA without converting from or into anything else.
here is an importer for Blender 2.67 :
https://github.com/littleneo/directX_blender
it currently supports x in ascii format, imports verts, faces, uv and vertices weights (multimesh support)
there's a bit of support for parenting and armatures but it's still pending/messy.
goals of the author, which is me, are to import anything from x, and supports binary format*.
[* but I need feedback, hughs, spare time, and complex testfiles to do so ;) ]
Use this program to convert .X files to a format that Blender can import, modify it and export as a .X file.
Ok, so found out that Blender 2.49 just does the trick: can import .X and export into .X too; uses text only. Newest Blender (2.57 or so) is unable to import .X - but will export into.
So when you go for using Blender download the "older versions".
Edit: you can get previous versions here:
http://download.blender.org/release/
Edit: you can find usefull info from .X file format here: http://paulbourke.net/dataformats/directx/
Best solution found so far is UU3D (Ultimate Unwrap 3D), downside is that it is not free, but does the trick. For more info see this:
https://gamedev.stackexchange.com/questions/13399/tool-for-editing-x
Edit: Blender can Import .X.. not animations tho' and only one mesh. Up to version 2.49b it can export with animations. So better to write an own plugin, because the shipped one is crap.
Ok, so found out that Blender 2.49 just does the trick: can import .X and export into .X too; uses text only. Newest Blender (2.57 or so) is unable to import .X - but will export into.
So when you go for using Blender download the "older versions".
Edit: you can get previous versions here: http://download.blender.org/release/
Edit: you can find usefull info from .X file format here: http://paulbourke.net/dataformats/directx/
You can use Alin's DirectX Exporter for 3ds Max, It supports standard and DirectX shader materials, use it to export your scene data as DirectX (.x) file, then import it into Blender.
download it's free version

Using EXR images in OpenCV

I'm currently working on a project with OpenEXR and I would like to implement some Blob detection algorithms. To do this I figured that I could use OpenCV as it says in the documentation that it can open OpenEXR format files.
I have all the libraries installed and working as I've been doing other things. I open a simple jpg file with openCV cvLoadImage. It works fine. But when i try to open any .exr file it doesn't seam to like it. I get a gray window where there should be the image display.
Has anyone done any tests with OpenCV and OpenEXR libraries working together? Have they worked for you? What do you think?
Thanks.
Yes, that's done, I posted a Ticket in the OpenCV project at willowGarage and they made all needed changes, you now can use OpenEXR with OpenCV as before!
Great
My HDR tone mapping algorithm will work again, cool
Have a nice programming now ;o)
Alex
Well Alex!
My news aren't really encouraging... I tried to use OpenEXR with OpenCV but it's not doing it's work. It says in the documentation that OpenCV 2.0 has OpenEXR support but...
I've searched the web to find some example of working EXR images in OpenCV but had no luck.
At this time I've developed myself a function to convert an image read with the OpenEXR libraries that uses Ilm::Rgba* structure to save the pixels of the image and convert it to char* that OpenCV uses with images. The IlpImage structure is the one I use. Actually I'm working with an example from OpenFrameworks and using they're Image structure...
It's a really early stage in my development because I had to start over...
I hope this can help you... but if you enter the world of OpenEXR it's a pretty dark world in terms of documentation, so all I can say is good luck!
Feel free to contact me and I'll see if I can help you!
This question is rather old now, but I noticed whilst reading the OpenEXR manual today that it says (whilst talking about reading named channels)
If one of those channels is not present in the image file, the corresponding memory buffer for the pixels will be filled with an appropriate default value.
I'd speculate here that the grey image you are seeing is an "appropriate default value".

Problem with showing some JPG files in Delphi

i have tried to open some JPEG files in Delphi with TImage component. i also added the Jpeg unit. i can open most of jpg files and there is no problem.
but when i try to open some JPGs, the program just throw an exception.
i also tried to load that images in design mode, but there is some problem. in design mode the exception is:
Access violation at address 402672A1 in module 'vcljpeg70.bpl'. Write of address 08E84000
Why i cannot open that JPGs? they are not corrupted. i checked them in some tools like savantools EXIF viewer.
here is the URL of one of that images:
http://xs842.xs.to/xs842/09340/backpic435.jpg
Thanks so much
PS:
My Delphi version is 7. Borland Delphi 7
The reason you may be encountering this problem is due to the file type. Delphi has issues displaying JPEG images that have been encoded using CMYK, rather than the default RGB encoding. CMYK is a format that is generally used for Print design, try and always encode your images to RGB format to avoid this issue with Delphi.
Patch for Delphi jpeg.dcu
Bye.
Interesting. Neither Internet Explorer nor Google Chrome will display that JPEG image you linked to. I do not get 404 Not Found errors, I simply get an image placeholder, indicating that the image could not be opened/displayed correctly.
FireFox does display the image.
Are you certain that there is not something fishy, or at least slightly unusual, about the JPG files involved?
UPDATE: The file linked to in the question opens in PaintShop Pro (an old version 6.0 installation) - if I then simply re-save as a Standard Encoding JPEG, IE and Chrome both display the newly saved image as I'd expect. There would definitely appear to be something a bit "odd-ball" about the encoding of the original JPEG that some JPEG apps can handle but not all, including some "major players", not just Delphi. :)
Check out the Free Image library for alternative JPEG support in Delphi if the native one has problems. Free Image is an open source lib that lets you work with JPEG/PNG/... from Delphi/BCB/and others. Very nice library IMHO.
http://freeimage.sourceforge.net/
I've looked at the file with a hex editor, and found 3 JFIF headers. After extracting each part, I found 2 thumbnails and an image. Nothing special, because embedded thumbnails seem to be part of the EXIF2 standard.
The thumbnails themselves load fine in Delphi, and converting the file to something readable can be done with almost every piece of software that I've tried.
Anyway, this page will give you very detailed information about the picture, and what headers are inside (just paste the url of your image in the textbox):
http://www.monster-submit.com/resources/jpeganalyzer/
I get the same error. This appears to be a bug in Delphi's JPEG lib. You should report it to QC.
SimDesign's NativeJpg can open that file. It's a JPEG library written entirely in Delphi, and the author has been good about adding support for new extensions and color spaces when we've run into them. In addition to a TGraphic descendant for TImage support it exposes lots of lower-level interfaces for manipulating JPEGs, though I haven't used them.

Resources