Thanks for the recommendation.
-- Yuri
On Wednesday, September 10, 2014 4:30:13 AM UTC-4, Tim Holy wrote:
>
> Your approach is fine, but maybe easier is to use ImageView's canvas grid,
> and
> then you can use write_to_png(cg, filename).
>
> --Tim
>
> On Tuesday, September 09, 2014 07:16:04 PM Yuri Vishnevsky wrote:
> > Hi all,
> >
> > I'm writing code to take a bunch of images and concatenate them into one
> > big image (you can see the attached picture for an example of what this
> can
> > look like).
> >
> > The code I wrote to generate the above picture is fairly hideous; I
> arrived
> > at it after trying a number of approaches that seemed more natural and
> then
> > giving up in despair.
> >
> > The code I initially wanted to write looked something like this:
> >
> >
> > grid = Char[
> > 'A' 'B' 'C' 'D' 'E';
> > 'F' 'G' 'H' 'I' 'J';
> > 'K' 'L' 'M' 'N' 'O';
> > 'P' 'Q' 'R' 'S' 'T';
> > 'U' 'V' 'W' 'X' 'Y';
> > 'Z' 0 0 0 0 ;
> > ]
> >
> > arr = map(c -> c == 0 ? zeros(Ufixed8, 64, 64) : convert(Array,
> > imread("$prefix/sdf/$c.png")), grid)
> > imwrite(arr, "$prefix/atlas.png")
> >
> > This approach fails in imwrite because the individual elements in the
> array
> > are themselves arrays, rather than numbers. I couldn't figure out a way
> to
> > flatten the resulting array-of-arrays into a single matrix and ended up
> > writing code that preallocates a big matrix of the right output size and
> > assigns to calculated subranges in a loop.
> >
> > My background is in user interface design and web programming, and right
> > now I'm fairly new to writing matrix-manipulation code. If there's a
> > natural way to express this computation in Julia I'd love to know.
> >
> > Cheers,
> > Yuri
>
>