I'd like to know where can I find some reference/manual that explains how to deal with common file formats ( zip, jepg, gif, png, elf binaries, etc) so that i can use them in my programs.
I already know that there are many libraries that would get the work done for me and that wolud do it better than I could ever do, but i'd just like to understand them for fun.
Thanks
Related
I want to have a base64 encode a .mo file and use it as the translation file for wxPython. Since it will be located in a .py file.
I have a wxPython project that is getting compiled a couple different ways. Icons are no trouble because they are packed in a .py file and base64. Translations in .mo files are a pain in the butt. Is it possible to do this same cheat for the translations? Include them not in a correct .mo file, but just dump the translation in base64, or gzipped base64?
wx.FileTranslationLoader() seems to be the only wx.TranslationLoader() that exists. It says I can replace that translation loader and use my own. https://wxpython.org/Phoenix/docs/html/wx.Translations.html#wx.Translations.SetLoader However to do that I need to return an msgCatalog which isn't apparently an object type that I can find anywhere.
This seems like a solid method of faking this so builders that pack all my .py will be set for their translation files but it doesn't seem easily doable but maybe there's an easy hack I'm missing. Maybe ducktype the MsgCatalog but I dunno what methods it needs to have. And I don't actually want to read the .mo myself, just give it a bytestream like object. In theory I could write the mo a locale directory but usually the internal fileystems of various installs are fake so I'd end up writing some weird files to disk. I suppose I could do that in the temp directory but that seems extra hacky.
I have an XML file produced with Gnumeric that contains images, stored as GOPixbuf strings inside XML. They look like this:
eXyA/4KEiP9xcnf/f3+E/3l5ff9xb3L/jo2Q/29wdP+ [truncated]
For each string I have width and height, and a rowstride parameter, like in this example:
<GOImage name="Image(70)" type="GOPixbuf" width="151" height="135" rowstride="604">
Is there a reasonable way to convert that to an image - any format will do?
I'm conversant with perl and image conversion tools (imagemagick, gimp) but I have not found any documentation by googling beyond GTK or GOffice docs.
You have already found stuff that is helpful. But since there are no Perl bindings for this on CPAN, you would have to make your own if you want to use Perl.
Fortunately, you don't have to know XS to do that. You can use FFI::Platypus to create temporary bindings and only map what you need.
The docs you have probably already found have a Getting started with GOffice section. After a quick check I found that on my recent Ubuntu there is a package that contains that lib. It is called libgoffice-0.10-dev.
Now you can set that up and play around with the lib functions. Somewhere in https://developer.gnome.org/goffice/unstable/GOImage.html there probably is a method to read and convert it.
One of the good ones might be go-image-get-pixbuf, which returns a GdkPixbuf. That in turn has a very extensive documentation. Maybe what you need might be in this one.
Good luck.
Is there a way to extract the size and address of elements within a structure using an elf file? I am hoping there is a tool available that can do this and export it to a more readable format.
My end goal is to convert the ELF file to a ASAM A2L file. A open source/free tool that could do this would even be better but most companies that do this charge alot for their tools.
I don't know offhand of anything pre-canned, but it isn't very hard to modify an existing tool to do it.
The "pahole" program from the "dwarves" project does something similar. It prints a structure definition in a certain way.
There's also a "pahole.py" script for gdb that does pretty much the same thing. This would be trivial to modify to print things however you like.
If you want to get a little deeper you could write it yourself using one of the existing DWARF libraries. I like the one in elfutils, but YMMV.
I have a folder of image file which have been compressed into .dat file. Since the .dat files are extremly huge(They are the microscopic image of the organ.), I don't really know what kind of tools that I can use to convert it into jpeg file. So the best case would that the whole image is split up into pieces, and I can get all the pieces of the image.
The ".dat" file suffix is used broadly, so you'll need to specify more details on what format/source software created the original data. As a guess, from a quick search of ".dat" format microscopy, these tools looks like they might be applicable to your domain:
http://gwyddion.net/
or
http://www.openmicroscopy.org/site/products/bio-formats
If you can't find a library for the format/languages you are using, then you'll need to find documentation of the file format, and write a converter (at least, the reading portion of the converter - you can use something like libjpeg to handle the writing portion.)
I am aiming to combine multiple PDF files each with identical dimensions into one file.
I've seen how it is done with CGPDFContext. I am just curious if there are (better?) alternatives to this method on the Mac.
Let's say I have the option to use PDFs, TIFF, PNG or JPEG files as input. Would using a different input file type mean anything significant for the process, or it would be easier to go with PDF input?
I have use PDFDocument API and it is programmatically easier to use. It may need PDF files as input though.