SVG and PNG Clip Art Stack

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

ClipArtGuy
Posts: 265
Joined: Wed Aug 19, 2015 4:29 pm

SVG and PNG Clip Art Stack

Post by ClipArtGuy »

Capture.JPG
I have written this small stack as a front-end of sorts to http://www.openclipart.org using their API , available here: https://openclipart.org/developers
It also uses Bob Hall's FastJSON library which is included as a sub-stack. Available here:
https://github.com/bhall2001/fastjson/b ... astjson.lc

It allows you to search a library of almost 100,000 images and download up to 10 images at a time in both SVG and high quality PNG formats.
Most of the program is in the card script, I'd love to hear what you think.

https://www.dropbox.com/sh/lzsun4gg4lgz ... HwfDa?dl=0

ClipArtGuy
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: SVG and PNG Clip Art Stack

Post by Klaus »

Very cool, thank you very much for sharing!
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10415
Joined: Fri Feb 19, 2010 10:17 am

Re: SVG and PNG Clip Art Stack

Post by richmond62 »

Wonderful: Thanks!
ClipArtGuy
Posts: 265
Joined: Wed Aug 19, 2015 4:29 pm

Re: SVG and PNG Clip Art Stack

Post by ClipArtGuy »

Thanks to the new JSONimport() function, this stack no longer requires a 3rd party JSON library. It also seems to be a bit faster as well.

https://www.dropbox.com/sh/76z1nwrdl8fo ... O4Xka?dl=0
capellan
Posts: 654
Joined: Wed Aug 15, 2007 11:09 pm

Re: SVG and PNG Clip Art Stack

Post by capellan »

Wonderful and really useful stack!
Many, many thanks for sharing :D

From your stack, How could we read or
search very specific data from svg source
code before downloading a file?

For example, Does exist some way to read
the svg source code to learn this information?

I am collecting svg files created using different apps,
(besides Inkscape and Ilustrator) and your stack
could help me in this task.

Thanks in advance!

Alejandro
[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: SVG and PNG Clip Art Stack

Post by [-hh] »

Hi ClipArtGuy,
your stack is a jewel, both from scripts and the available actions. Thanks!
You should think about changing your nickname to ClipArtKing.
Attachments
LG-Crown13.png
LG-Crown13.png (36.24 KiB) Viewed 19759 times
shiftLock happens
ClipArtGuy
Posts: 265
Joined: Wed Aug 19, 2015 4:29 pm

Re: SVG and PNG Clip Art Stack

Post by ClipArtGuy »

capellan wrote:Wonderful and really useful stack!
Many, many thanks for sharing :D

From your stack, How could we read or
search very specific data from svg source
code before downloading a file?

For example, Does exist some way to read
the svg source code to learn this information?

I am collecting svg files created using different apps,
(besides Inkscape and Ilustrator) and your stack
could help me in this task.
The large preview area to left has a custom property called cSVGdownload that contains the URL of the SVG being previewed. (Actually all the gallery images have this property as well) So a simple way to see the text of the SVG would be as easy as:

Code: Select all

  get URL (the cSVGdownload of img "viewer")
 answer it 
I think this would be sufficient to see and search the SVG source. You could also loop through images "gallery1" through "gallery10" and grab the source of 10 at a time. I am fairly certain though, that most if not all images on OpenClipArt are passed through inkscape prior to being uploaded.
[-hh] wrote:Hi ClipArtGuy,
your stack is a jewel, both from scripts and the available actions. Thanks!
You should think about changing your nickname to ClipArtKing.
Thanks and Thank you for all great stacks for the Raspberry Pi!
capellan
Posts: 654
Joined: Wed Aug 15, 2007 11:09 pm

Re: SVG and PNG Clip Art Stack

Post by capellan »

Great! :D After, I finish some pending work, I will add a small button with your code in the stack GUI.
Last time I checked, whole clipart collection from Openclipart is more than 10 Gb. :shock:

Hopefully, in a near future LiveCode will import SVG files as an image with transparency (like PNGs).

Have a nice week!

Alejandro
ClipArtGuy
Posts: 265
Joined: Wed Aug 19, 2015 4:29 pm

Re: SVG and PNG Clip Art Stack

Post by ClipArtGuy »

capellan wrote:Great! :D After, I finish some pending work, I will add a small button with your code in the stack GUI.
Last time I checked, whole clipart collection from Openclipart is more than 10 Gb. :shock:

Hopefully, in a near future LiveCode will import SVG files as an image with transparency (like PNGs).

Have a nice week!

Alejandro
I have added a "view SRC" button underneath the preview area. Clicking this button will get the SVG data and open it in a resizable substack called "sourceviewer" with an editable text field. The script is right in the button.

https://www.dropbox.com/sh/eo7k7g4jvdwp ... Bgypa?dl=0
ClipArtGuy
Posts: 265
Joined: Wed Aug 19, 2015 4:29 pm

Re: SVG and PNG Clip Art Stack

Post by ClipArtGuy »

I just added a "Save SVG" button to the source viewer stack, so now you can edit the source and then save as SVG if need be. It's the latest version in this dropbox folder (1.3 as of this writing). I will continue to push updated versions to this folder.

https://www.dropbox.com/sh/lzsun4gg4lgz ... HwfDa?dl=0
[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: SVG and PNG Clip Art Stack

Post by [-hh] »

Hi "ClipArtGuy",

your excellent stack is soon getting lost in this big subforum.
TMHO, you should think about uploading it to revOnline (="Sample Stacks" from the revMenuBar).

Hermann

p.s. Alejandro, if you read this. The same is true for the great SVG stacks you created!
shiftLock happens
ClipArtGuy
Posts: 265
Joined: Wed Aug 19, 2015 4:29 pm

Re: SVG and PNG Clip Art Stack

Post by ClipArtGuy »

[-hh] wrote:Hi "ClipArtGuy",

your excellent stack is soon getting lost in this big subforum.
TMHO, you should think about uploading it to revOnline (="Sample Stacks" from the revMenuBar).

Hermann

p.s. Alejandro, if you read this. The same is true for the great SVG stacks you created!
Thanks again Hermann! 8) It's definitely something I plan on doing, there are a few more things that I'd like to work on when I get a chance before doing so, hopefully soon.
[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm

Re: SVG and PNG Clip Art Stack

Post by [-hh] »

Hi "ClipArtGuy",

your stack works *perfectly* in LC 8 but has several problems in LC 9.0.0-dp2 probably connected to networking only. Networking is _very_ slow, startup and "View SRC" need a full minute. Do you see why? You could then think about reporting this to QCC.

Hermann
shiftLock happens
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10415
Joined: Fri Feb 19, 2010 10:17 am

Re: SVG and PNG Clip Art Stack

Post by richmond62 »

I wonder why, when I downloaded the downloader stack 1.3 onto my Mac Livecode told me it was not a stack?

Would be grateful if you could upload it in a zip file.
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: SVG and PNG Clip Art Stack

Post by Klaus »

Just downloaded the stack from his Dropbox and did not have any problems!?
Post Reply