Radical Image URLs in Black?


#1

Fellow Developers,

I’m just starting a project using the WaniKani API and would like to display the radical character/images in my app.  Specifically, I’m working with the output from the “Radical List” from the API.

Lots of radicals are just regular characters that are stored in the “character” entry of the radicals “requested_information” data.  No problem here.

However, some radicals, like “stick” are represented by an image, specified by URL in “image” of “requested_information” (an amazon S3 link).  Unfortunately for me, these images are white and don’t show-up against a white background in my app.

Anyone know if there’s are black version of these images, or have dealt with this in some other way?  I’m trying to avoid downloading them all (not sure how to easily get this list) and converting myself… but that may be the only option.

Thanks for the assistance!


#2

I’m sure the background of the images are transparent, so you can just invert the image to get a black and transparent image. And i’m sure there are basic image processing functionality (like inverting) on whatever platform you are developing on.


#3

Rincewind – thanks for the suggestion.  I was thinking I’d have to go down that route, but thought the long time developers here would have potentially come across another solution.  Maybe your solution IS the solution others have used :).  Or maybe folks are just putting the images against colored backgrounds like on the main WK site.

I did a search through the forums here and didn’t come across any discussion of this – I was somewhat surprised.

Thanks again!


#4

The radicals that use images are:

Level 1: Gun, Leaf, Stick
Level 3: Hat, Nailbat
Level 4: Beggar, Flower, Horns, Pi, Spikes, Umbrella
Level 5: Coffin, Key, Kick, Lantern, Mustache, Tsunami, Viking, Water Slide
Level 6: Animal, Fish Tail, Ribs
Level 8: Cloak, Hills, Sauron
Level 9: Butcher, Cleat, Clown, Pope, Train
Level 10: Chinese, Geoduck, Sick, Superman, Tombstone
Level 11: Bear, Blackjack, Boob
Level 12: Tofu
Level 13: Creeper, Fish Stick, Roof, Womb
Level 14: Bar, Pool
Level 15: Grass, Saw
Level 16: Squid, Zombie
Level 17: Hick, Poem, Worm
Level 18: Gambler
Level 19: Black Hole
Level 20: Arrows, Explosion
Level 21: Mohawk
Level 22: Football, Slinky
Level 23: Corn, Four
Level 24: Cow God, Death Star
Level 25: Circus, Greenhouse
Level 26: Egg
Level 27: Comb
Level 28: Hercules
Level 29: Morning, Ox
Level 31: Bookshelf, Chester, Potato, Rocket
Level 32: Cat Pirate
Level 33: Shark, Sock
Level 34: Slice
Level 38: Propaganda
Level 41: Cactus, Signpost, Trident
Level 50: Psychopath, Splinter

And yeah, I’d also recommend trying to do some kind of batch convert with GIMP. There are tutorials on how to do it here. I imagine it will be relatively painless.


#5

If it were me I would do one of the following:

1) If it’s a one time thing, batch process them. 
2) If you constantly want to pull the radicals to see if there are any new ones, just have a process that pre-processes the image upon download. If you’re using python, something like PIL would probably fit the bill. 


#6

Edit: Somehow double-posted


#7

BreadstickNinja – Awesome!  Thanks for getting me the list.  As you can see I’m a lowly level 6 so I don’t actually know which will require images using my own data.

Tadgh11 – I agree.  I need a system to deal with this.  Here’s my plan: Given a person’s API key, I’ll pull all the radical images I haven’t already cached and processed, image process them, then save them to the cache.  Then, if I can get someone like BreadstickNinja to use my app, I should have the complete list.  If I want to get “real fancy”, I’ll also store the associated URL’s and if those happen to change for a give radical I’ve already processed, I’ll reprocess…

Thanks again to all for the ideas and suggestions!