V format please

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

V format please

Post 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.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: V format please

Post 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?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: V format please

Post by magick »

Stand by. We're working on the V format. We'll need a few days.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: V format please

Post 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.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: V format please

Post 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?
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: V format please

Post 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?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: V format please

Post 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.
snibgo's IM pages: im.snibgo.com
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: V format please

Post 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
snibgo's IM pages: im.snibgo.com
jcupitt
Posts: 26
Joined: 2011-04-26T05:14:01-07:00
Authentication code: 8675308

Re: V format please

Post 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.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: V format please

Post 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.
jcupitt
Posts: 26
Joined: 2011-04-26T05:14:01-07:00
Authentication code: 8675308

Re: V format please

Post by jcupitt »

libvips now has .vips as an alternative suffix:

https://github.com/jcupitt/libvips/comm ... 33b4d92675
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: V format please

Post by dlemstra »

The vips coder has been added and will be available in the next release of ImageMagick (6.8.9-1).
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply