Page 1 of 1

V format please

Posted: 2014-04-19T14:41:51-07:00
by snibgo
IM forum, developers, V format please

I am writing an interface between ImageMagic and nip2. When complete, IM's features will be accessible from nip2's drop-down menus, sliders etc, not to mention the very slick spreadsheet-style interface.

To do this, nip2 (or the underlying engine, VIPS) reads vips files and writes tiffs. IM reads the tiffs, does its work, and writes a tiff. Finally nips2 translates it back to a vips file.

This takes time. Worse, we are discovering all the various TIFF formats that IM can write. John Cupitt is adapting the nip2/VIPS software as fast as I report problems, but I wonder if the task will ever end.

So, would it be possible to add ".v" as a new format for ImageMagic? The format is is documented:

http://www.vips.ecs.soton.ac.uk/support ... x7-70001.2

vips.c, to read and write V files, is:

https://github.com/jcupitt/libvips/blob ... ncs/vips.c

Thanks.

Re: V format please

Posted: 2014-04-19T15:30:07-07:00
by fmw42
snibgo,

Sounds like your are doing a lot of work getting most of the IM features into nip2. Kudos!

I note from the referenced file:

"If you intend to keep an image, it’s much better to save it as TIFF, JPEG, PNG, PBM/PGM/PPM or HDR. VIPS can transparently read and write all these formats."

So correct me if wrong, but it looks like it can read and write all these formats. Out of curiosity, how does it help you to have IM read/write .v format files? Is it just a speed issue in nips that will make your development time faster for testing?

Re: V format please

Posted: 2014-04-19T16:21:01-07:00
by magick
Stand by. We're working on the V format. We'll need a few days.

Re: V format please

Posted: 2014-04-19T17:05:23-07:00
by snibgo
Thanks, Magick.

Fred, yes, progress is going well. All credit to John for creating a powerful system that is so easy to interface with, and modifying VIPS so IM can take inputs from multiple cells (for -composite, -remap, -clut, etc).

Image

For example, here is one cell in a worksheet, cell A11. The result is the image at the top. It came from a blur of cell A9. The blur options are shown: radius, sigma, channels, and one I've called "virtpixback" that expands to "Virtual pixel" and a background colour (which is relevant only when "Virtual pixel" is "background", but I haven't figured out how to hide it.) The user can shrink any or all of the options to save screen space. The user can push the sliders until the image shows exactly the desired amount of blur.

I've done almost all the IM operations that create a single image output, so that includes things like -composite and -morphology. I have more testing and tweaking to do, eg the morphology kernel arguments is just a user-input string at the moment, and I'd like it to be friendlier: some kernels need "radius,scale", some need "width x height + offsx + offsy", etc.

This is one of those projects where 95% takes a month, and the rest takes a year. The first release will contain just 95% of what I'd like.

Yes, VIPS reads and writes TIFFs. But TIFF has a massive number of formats. So far, IM has always managed to read all the TIFFs that VIPS makes. But sometimes IM makes a TIFF that VIPS can't read. My hope is that if IM can read and write VIPS files, the interface won't need to go via TIFF files, so we will overcome that issue.

If we don't need to go via TIFF files, it will also be faster for users, though that's not my current primary objective.

Re: V format please

Posted: 2014-04-19T17:22:45-07:00
by fmw42
According to that documentations, nips2 can read and write PNG, JPG and PNM, etc. So why use TIFF? PNM can handle multiple channels, if that is the issue?

Re: V format please

Posted: 2014-04-20T03:27:03-07:00
by dlemstra
Would you mind posting some .vips files we can use for testing? Can we use the .vips extension instead of just .v? Does .vips not support transparency (RGBA) or is there another page that describes that?

Re: V format please

Posted: 2014-04-20T09:24:38-07:00
by snibgo
Sample files, based in the above image:

nip2blur.v
3-channels, RGB
https://www.dropbox.com/s/530vr2cggkvcppk/nip2blur.v

nip2blur1.v
1-channel, greyscale
https://www.dropbox.com/s/rjn4s7r0fqxopnz/nip2blur1.v

nip2blur2.v
2-channel, greyscale + alpha
https://www.dropbox.com/s/7mo6gfnz5puvisx/nip2blur2.v

nip2blur4.v
4-channels, RGBA
https://www.dropbox.com/s/rv4thfetdf6563h/nip2blur4.v

nip2blurCMYK.v
4-channels, CMYK
https://www.dropbox.com/s/6a9cjc04i6w30 ... blurCMYK.v

nip2blurCMYKA.v
5-channels, CMYKA
https://www.dropbox.com/s/urjpr4529eiae ... lurCMYKA.v

The standard extension is ".v".

Terminology confusion: what IM calls "channels", VIPS calls "bands".

Thanks.

Re: V format please

Posted: 2014-04-20T10:54:00-07:00
by snibgo
I should have said: the above images are "8-bit unsigned".

Here are some other formats, based on a plasma image. They are all 4-channel, RGBA.

nip2plas4.v
16-bt unsigned
https://www.dropbox.com/s/yrtey0whmbfe02q/nip2plas4.v

nip2plas4flt.v
32-bit float
https://www.dropbox.com/s/cm7f9f7eyuwbr ... plas4flt.v

nip2plas4flt64.v
64-bit float
https://www.dropbox.com/s/ps75v8c6abcon ... as4flt64.v

Re: V format please

Posted: 2014-04-21T11:46:27-07:00
by jcupitt
Hello all, I'm the libvips maintainer, snibgo pointed me here. Thanks for considering adding vips format to IM.

Sure, make it .vips, I expect .v is taken. I'll add .vips as an alternative extension in libvips and nip2.

No, .vips format has no explicit support for transparency, but by convention it goes after any colour channels. The PNG loader orders channels as RGBA, for example.

The XML after the image data is a set of name/value pairs and is used for things like icc profiles, EXIF, image history and so on. You can probably just ignore it, vips will load an image with missing XML metadata.

vips has a load-via-imagemagick operation which might also be helpful:

https://github.com/jcupitt/libvips/blob ... ick2vips.c

There's no save-via-IM operation, there probably should be.

Re: V format please

Posted: 2014-04-21T12:17:06-07:00
by glennrp
jcupitt wrote:Hello all, I'm the libvips maintainer, snibgo pointed me here. Thanks for considering adding vips format to IM.

Sure, make it .vips, I expect .v is taken.
Yup. http://www.solvusoft.com/en/file-extens ... tension-v/
Although I don't believe that it is registered with IANA.

Re: V format please

Posted: 2014-04-22T01:34:24-07:00
by jcupitt
libvips now has .vips as an alternative suffix:

https://github.com/jcupitt/libvips/comm ... 33b4d92675

Re: V format please

Posted: 2014-04-26T11:27:23-07:00
by dlemstra
The vips coder has been added and will be available in the next release of ImageMagick (6.8.9-1).