Closed Pavle37 closed 6 years ago
thanks for the feedback.
you can use any string you want. you don't even have to use a string. it's detailed in the README: https://github.com/moagrius/TileView#tiles. you can supply your own BitmapDecoder
to get bitmaps in any way you want to. for the simple change you mentioned, just use the provided BitmapProviderAssets
and change the order of the arguments passed it - it's a very straightforward String.format
call: https://github.com/moagrius/TileView/blob/master/tileview/src/main/java/com/qozix/tileview/graphics/BitmapProviderAssets.java#L34
next, the code provided for imagemagick certainly does work out of the box, at least with the version of imagemagick around at the time (5+ years ago), and i've used it to create tiles many time. double percent have special significance.
anyway, glad you got it working, maybe documenting your experience will help others in the future
@moagrius Yeah thanks for explaining the library and how i can do that straightforwardly. I also hope it helps somebody, especially with your take on the matter and explanation how they can do that in the library itself :) cheers!
Hello,
I was just starting to use the TileView library and i ran into problems when using the ImageMagick tool. I've followed the documentation provided here but without luck.
Finally after about 2hrs of exhaustive searching on ImageMagick forums, trying to find the right online tool and million other ideas i did it. I just want to share my experience, thoughts and mistakes in hope that i will save somebody the frustration that i've gone through.
Here is the list of things i tried that i think other people will try as well and what's wrong with that:
Using an online tool... Using an online tool can be a good way to split the images up, but what made it difficult for me was the naming conventions used there. Generally all online tools name their splits something like this *filename_row_column" and it is in direct opposite of this libraries naming convention that goes "filename_column_row" and i had more than 200 tiles so renaming all of them was out of the question. I tried to find a solution to edit the library, but that seemed a bit too much, because i found no straightforward way to reverse the columns and rows in the filename.
Back to ImageMagick... After I've tried almost all online tools, I've returned more determined than ever to make the ImageMagick work. When i tried to do what the code in the library suggested, i ended up with file named "%[filename" or ended up getting some errors. I noticed that errors were probably caused by my destination ( i was in Program Files/ImageMagic... ) so i copy/pasted the "convert.exe" into a folder on desktop. After countless tries, forum searches and error googling i finally found what was the correct way to do the splitting....
convert my_image.png -crop 220x220 -set filename:tile "tile_%[fx:page.x/220]_%[fx:page.y/220]" "%[filename:tile].png"
What i had realized is that filename:file is a variable and referencing that variable requires only one % and in the code supplied in the library there were %%. Second thing was that i was getting some random error saying that i cannot open the image file. After further research i deducted that perhaps ImageMagick couldn't write to the Desktop for some reason so i transferred the whole folder ( with convert.exe and my_image.png ) to the "D" partition. That finally worked.TLDR;
Easiest way to do split is:
convert my_image.png -crop 220x220 -set filename:tile "tile_%[fx:page.x/220]_%[fx:page.y/220]" "%[filename:tile].png"