datavis

2016-01-25T14:22:42.000002Z

@stathissideris: do you support embedding images in SVG with dali?

stathissideris 2016-01-25T14:23:03.000003Z

@kephale other SVGs or bitmaps?

2016-01-25T14:23:50.000005Z

bitmaps is more this question, sometimes i can get them to other vector graphics formats though

stathissideris 2016-01-25T14:25:20.000006Z

so you can embed them like you would do with normal SVG syntax (dali is just a layer over normal SVG anyway). There are currently no functions that make it more convenient, but I'd like to add some functionality for that

stathissideris 2016-01-25T14:26:01.000007Z

If you'd like to give me some use cases I'd be happy to take them into account

stathissideris 2016-01-25T14:26:31.000008Z

also, the 0.7.0-SNAPSHOT is release quality if you'd like to give it a go

2016-01-25T14:26:42.000009Z

the most minimal use case that would probably keep me happy for a long time would just be tiling images side-by-side with graphs

stathissideris 2016-01-25T14:27:04.000011Z

the reason I haven't announced yet is because of lack of documentation

stathissideris 2016-01-25T14:27:24.000012Z

which is in progress here: https://github.com/stathissideris/dali/tree/0.7.0

2016-01-25T14:28:27.000014Z

cool, i’ve been pretty happy so far, but being able to toss raster/bitmap images in would make it easier to go all-in

2016-01-25T14:28:42.000015Z

still doing a bit of that in manual programs like Illustrator

stathissideris 2016-01-25T14:28:44.000016Z

you mean you've used it already?

2016-01-25T14:29:13.000018Z

enough to know that it covers almost all the bases for me

2016-01-25T14:29:24.000019Z

but still not for my final figures

stathissideris 2016-01-25T14:29:36.000020Z

oh wow, hadn't realised I had users, that's good to know!

2016-01-25T14:30:11.000021Z

hiccup+svg FTW

stathissideris 2016-01-25T14:30:51.000022Z

yeah, tell me a bit more about what you'd like to do and I'll add some stuff post-0.7 (I'd like to get the release out of the way before I add more features)

2016-01-25T14:30:57.000023Z

with rasters then i can start trying to convince people that i’ve made the plots in illustrator

stathissideris 2016-01-25T14:31:52.000024Z

@kephale: also, if you'd like to contribute any examples, that would be most welcome

2016-01-25T14:31:55.000025Z

i mean literally just being able to toss in bitmaps in, i have things like N images that biologists have taken, pull out a good example, and need to side by side that with a graph that describes all N images based on some measured features

2016-01-25T14:32:42.000026Z

right now there are still some manual steps at the end, where i’m tossing the raster image next to the vector-based graph in something like powerpoint or illustrator

2016-01-25T14:32:56.000027Z

but one can imagine how that slows down the iteration cycle

stathissideris 2016-01-25T14:33:06.000028Z

I'll experiment a bit with the image tag then :simple_smile:

2016-01-25T14:33:11.000029Z

woohoo! thanks

stathissideris 2016-01-25T14:33:50.000031Z

I was thinking that embedding other SVGs may be higher priority

stathissideris 2016-01-25T14:34:03.000032Z

but you have a real use case

2016-01-25T14:35:44.000033Z

yeah, i mean embedding other SVGs is certainly useful, but just supporting bitmaps would go a long way since worst case folks with existing SVGs cooould rasterize them if need be

2016-01-25T14:35:51.000034Z

certainly all the downsides of rasterizing come with that

2016-01-25T14:36:37.000035Z

so it temporarily covers some SVG import cases

2016-01-25T14:36:42.000036Z

albeit not pleasantly : P

stathissideris 2016-01-25T14:37:09.000037Z

so you'd lay them out using [:matrix] or something?

2016-01-25T14:41:36.000038Z

for the tiling case, in the longer run i can definitely foresee some use cases where one has something like 1 big graph, then wants to put example images next to things like peaks in the graph (this bump corresponds to the healthy samples, and this other one one corresponds to the pathological cases)

stathissideris 2016-01-25T14:49:55.000039Z

that would have to be manual

stathissideris 2016-01-25T14:50:08.000040Z

I mean you'd have to mess around with coords

stathissideris 2016-01-25T14:50:26.000041Z

dali can only help you this grid-like layouts mainly

2016-01-25T14:51:20.000042Z

Yeah, manual is fine/expected for that

2016-01-25T14:51:55.000043Z

quick grid tilings solves a lot of things anyway

stathissideris 2016-01-25T14:56:42.000044Z

cool

2016-01-25T22:42:41.000048Z

@stathissideris: awesome!

stathissideris 2016-01-25T22:43:06.000051Z

get the latest snapshot to get this functionality

stathissideris 2016-01-25T22:43:24.000052Z

haven't tried with JPEGs, let me know if you do

stathissideris 2016-01-25T22:43:36.000053Z

just PNGs for now

2016-01-25T22:45:33.000054Z

fair enough about pngs

2016-01-25T22:46:01.000055Z

is it dynamically loaded or somehow stashed in the svg?

stathissideris 2016-01-25T22:46:11.000056Z

embedded

2016-01-25T22:46:15.000057Z

oh, cool

stathissideris 2016-01-25T22:46:18.000058Z

just realized something

2016-01-25T22:46:31.000059Z

would you be opposed to leaving a function that could take the raw bytes + width + height as args?

stathissideris 2016-01-25T22:46:34.000060Z

the snapshot wont work, but I can fix it quickly

stathissideris 2016-01-25T22:46:36.000061Z

gimme a second

2016-01-25T22:47:17.000062Z

i frequently have the image in memory loaded from any one of many biological image formats

stathissideris 2016-01-25T22:47:25.000063Z

ah bytes, didn't think about that

stathissideris 2016-01-25T22:47:32.000064Z

what format is your image?

stathissideris 2016-01-25T22:47:41.000065Z

the in memory one

2016-01-25T22:48:12.000066Z

i can toss it into any byte format, but presumably RGB or RGBA would be the way to go

2016-01-25T22:48:25.000067Z

as for the file format, it really might be any one of dozens

2016-01-25T22:48:41.000068Z

but i have functions for converting to RGB/RGBA no problem

stathissideris 2016-01-25T22:48:58.000069Z

in order to embed it, you have to turn it into a byte array tha corresponds to PNG or something

2016-01-25T22:49:03.000070Z

oh, or bufferedimage

stathissideris 2016-01-25T22:49:06.000071Z

even if it's in memory

2016-01-25T22:49:08.000072Z

i can get to those really easily

2016-01-25T22:49:35.000074Z

yeah, i believe a RGBA byte array would be the same as a png

2016-01-25T22:49:45.000075Z

basically the same thing that imageio/read produces

2016-01-25T22:50:31.000076Z

i mean filename is fine anyway, since it can always be written to disk anyway, but just noting that an in-memory handoff could be useful sometimes

2016-01-25T22:50:44.000077Z

either way i’m excited : )

eggsyntax 2016-01-25T22:51:38.000078Z

Y’all, FYI, just started a new job today, gotta turn notifications off for #C0F0V8DT5 — if anyone needs cljs-mathbox help or whatever, just ping me! Gotta drop out of general chatter for a while though...

stathissideris 2016-01-25T22:52:08.000079Z

@kephale: trying to think of good names for the different functions...

2016-01-25T22:52:12.000080Z

woohoo, good luck @eggsyntax !

eggsyntax 2016-01-25T22:52:20.000081Z

Thanks!

stathissideris 2016-01-25T22:52:40.000082Z

yeah good luck :simple_smile:

eggsyntax 2016-01-25T22:53:02.000083Z

Thanks :simple_smile:

eggsyntax 2016-01-25T22:53:34.000084Z

Probably silly to mention it, but since the channel’s been so tight-knit…I’m super glad this channel has taken off btw!

2016-01-25T22:53:55.000085Z

raster-bytes-attr?

2016-01-25T22:54:56.000086Z

or if you went for just supporting BufferedImages raster-bufferedimage-attr, something like that?

2016-01-25T22:55:14.000087Z

I think most folks with in memory images in java are likely to have helpers to get to BufferedImage

stathissideris 2016-01-25T22:55:22.000088Z

yeah

stathissideris 2016-01-25T22:56:15.000089Z

so I'll do support for BufferedImage later (but it is useful, you're right)

stathissideris 2016-01-25T22:56:23.000090Z

for now you should be able to say:

stathissideris 2016-01-25T22:57:28.000091Z

[:image {:width w :height h :xlink:href (io/data-uri bytes)}]

stathissideris 2016-01-25T22:57:39.000092Z

where io is <http://dali.io|dali.io>

stathissideris 2016-01-25T22:57:59.000093Z

but a version for bufferedImage would be more like the file version

stathissideris 2016-01-25T22:58:13.000094Z

in that it would give you a map with width and height as well

stathissideris 2016-01-25T22:58:31.000095Z

but let's start with that if you think it's enough

stathissideris 2016-01-25T23:07:34.000096Z

@kephale: So I've changed the API a bit and it now would be [:image {:width w :height h :xlink:href (io/data-uri bytes "image/png")}]

stathissideris 2016-01-25T23:07:42.000097Z

you have to give it a mime type

stathissideris 2016-01-25T23:08:12.000098Z

and the file based version is slightly different, see the URL from before

stathissideris 2016-01-25T23:08:23.000099Z

I've pushed a new snapshot

2016-01-25T23:29:04.000100Z

cool!

stathissideris 2016-01-25T23:34:00.000101Z

turns out that supporting BufferedImage is really easy: https://github.com/stathissideris/dali/blob/0.7.0/examples/src/dali/examples.clj#L598-L603

stathissideris 2016-01-25T23:34:30.000103Z

so in your case you'd have an image already, without the need to load it as in the example

stathissideris 2016-01-25T23:35:00.000104Z

that should work

stathissideris 2016-01-25T23:35:13.000105Z

and I just pushed yet another snapshot

stathissideris 2016-01-25T23:35:33.000106Z

ok off to bed, let me know how it goes!

stathissideris 2016-01-25T23:35:45.000107Z

@kephale

2016-01-25T23:37:15.000108Z

thanks @stathissideris i’ll have to delay on giving it a whirl for a couple of days, must get back to class prep, but this will be great for making figures!

stathissideris 2016-01-25T23:37:54.000109Z

yeah no rush, it'll be great to see what you make with it :simple_smile: