Message Boards Message Boards

1
|
3748 Views
|
3 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Newbie - How do I set up a form so that it has an image upload?

Posted 9 years ago

Hi

Sorry but this is a n00b question but i can't seem to find the documentation for this. I am trying to set up a form that can do image upload for ImageIdentify. The example, I saw was

CloudDeploy[FormFunction[{"size" -> "Number"}, Style["Hello World", Red, #size] &, "GIF"]]

Instead of Hello World, how can I change it so that it is an image and I can set a zoom size or something of that nature? I am just trying to learn the wolfram language by example.

Pointing to some documentation that is specific to this would be very helpful. Thanks

POSTED BY: s a
3 Replies
Posted 9 years ago

Also see this for a full example using APIFunction

http://community.wolfram.com/groups/-/m/t/537621

POSTED BY: Stephen Coast

It's hard to point at a specific piece of documentation to solve our problem. Here's the code you're looking for:

CloudDeploy[
 FormFunction[{"size" -> "Number", "image" -> "Image"}, 
  ImageResize[#image, #size] &, "GIF"]]

You can change the size of an image using the ImageResize function. To find that, you shave to search the documentation and learn a bit about how image processing works in Mathematica.

"Number" and "Image" are "Interpreter types". See the documentation of Interpreter for more examples. These "Interpreter Types" can be used as inputs to a form function. There are many of them.

POSTED BY: Sean Clarke
Posted 9 years ago

Thank you, that is very helpful, I have tried it with the new ImageIdentify function -

CloudDeploy[
    FormFunction[{"image" -> "Image"},
        ImageIdentify[#image]&,"PNG"]] 

It works, it is pretty cool. I then tried switching it to an API, which also worked. thanks for the help.

POSTED BY: s a
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract