Fork me on GitHub
#datavis
<
2016-01-25
>
kephale14:01:42

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

stathissideris14:01:03

@kephale other SVGs or bitmaps?

kephale14:01:50

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

stathissideris14:01:20

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

stathissideris14:01:01

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

stathissideris14:01:31

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

kephale14:01:42

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

stathissideris14:01:04

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

kephale14:01:27

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

kephale14:01:42

still doing a bit of that in manual programs like Illustrator

stathissideris14:01:44

you mean you've used it already?

kephale14:01:13

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

kephale14:01:24

but still not for my final figures

stathissideris14:01:36

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

kephale14:01:11

hiccup+svg FTW

stathissideris14:01:51

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)

kephale14:01:57

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

stathissideris14:01:52

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

kephale14:01:55

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

kephale14:01:42

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

kephale14:01:56

but one can imagine how that slows down the iteration cycle

stathissideris14:01:06

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

kephale14:01:11

woohoo! thanks

stathissideris14:01:50

I was thinking that embedding other SVGs may be higher priority

stathissideris14:01:03

but you have a real use case

kephale14:01:44

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

kephale14:01:51

certainly all the downsides of rasterizing come with that

kephale14:01:37

so it temporarily covers some SVG import cases

kephale14:01:42

albeit not pleasantly : P

stathissideris14:01:09

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

kephale14:01:36

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)

stathissideris14:01:55

that would have to be manual

stathissideris14:01:08

I mean you'd have to mess around with coords

stathissideris14:01:26

dali can only help you this grid-like layouts mainly

kephale14:01:20

Yeah, manual is fine/expected for that

kephale14:01:55

quick grid tilings solves a lot of things anyway

stathissideris22:01:06

get the latest snapshot to get this functionality

stathissideris22:01:24

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

stathissideris22:01:36

just PNGs for now

kephale22:01:33

fair enough about pngs

kephale22:01:01

is it dynamically loaded or somehow stashed in the svg?

stathissideris22:01:18

just realized something

kephale22:01:31

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

stathissideris22:01:34

the snapshot wont work, but I can fix it quickly

kephale22:01:17

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

stathissideris22:01:25

ah bytes, didn't think about that

stathissideris22:01:32

what format is your image?

stathissideris22:01:41

the in memory one

kephale22:01:12

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

kephale22:01:25

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

kephale22:01:41

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

stathissideris22:01:58

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

kephale22:01:03

oh, or bufferedimage

stathissideris22:01:06

even if it's in memory

kephale22:01:08

i can get to those really easily

kephale22:01:35

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

kephale22:01:45

basically the same thing that imageio/read produces

kephale22:01:31

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

kephale22:01:44

either way i’m excited : )

eggsyntax22:01:38

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...

stathissideris22:01:08

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

kephale22:01:12

woohoo, good luck @eggsyntax !

stathissideris22:01:40

yeah good luck simple_smile

eggsyntax22:01:34

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

kephale22:01:55

raster-bytes-attr?

kephale22:01:56

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

kephale22:01:14

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

stathissideris22:01:15

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

stathissideris22:01:23

for now you should be able to say:

stathissideris22:01:28

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

stathissideris22:01:59

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

stathissideris22:01:13

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

stathissideris22:01:31

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

stathissideris23:01:34

@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")}]

stathissideris23:01:42

you have to give it a mime type

stathissideris23:01:12

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

stathissideris23:01:23

I've pushed a new snapshot

stathissideris23:01:30

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

stathissideris23:01:00

that should work

stathissideris23:01:13

and I just pushed yet another snapshot

stathissideris23:01:33

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

kephale23:01:15

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!

stathissideris23:01:54

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