Is it possible to get a resized version of an image stored on Google Cloud Storage? - node.js

I'm using GCS to store my user's images in our react-native app. I need a small version of images so I can implement progressive loading. Is there any way to get a resized image from the GCS url or using any other method?
I'd like to avoid having multiple instances of the same image in our storage.
I know you can do something like:
http://lh3.googleusercontent.com/93uhV8K2yHkRuD63KJxlTi7SxjHS8my2emuHmGLZxEmX99_XAjTN3c_2zmKVb3XQ5d8FEkwtgbGjyYpaDQg=s250
with google photos, where the =sXX at the end (xx being any number between 0 and ~2500) is the size that returned image will be.
is it possible to do something similar using GCS?
this is what a url to an image looks like with respect to our app:
https://storage.googleapis.com/appName.appspot.com/1513912717946-Image_1513912675892.jpg

You need App Engine to generate those URLs, and this is only available in the standard environment.
Relevant docs are: Python, Java, PHP, and Go.
The API allows you to generate (and delete) those URLs. The generated URLs support the =sXX parameter. XX is an integer from 0–2560 representing the length, in pixels, of the image's longest side. It also supports cropping the image into a square with =sXX-c.
Elaborating: App Engine is Google's PaaS offering. You can read more about the standard and flexible environments here.

Related

how to upload image in mongodb using node js under a specific model

I am working on a project (Something like a shopping website) and I want to upload a product describing its name, price and image. It's pretty simple to add name, price in a database, but not finding a proper way to have all those information along with a product Image as there is no specific way to store image like we store Strings and Numbers etc. I do not want to upload a file locally with a package called multer. I have tried using Grid FS storage, but I do not how to make it keep all three information together as a single package. I am looking for a better way so I could use it when I will make my website live.
You can convert an image to a base64 encoded string. See this question for more information. Also see this npm package.
But be careful! As far as I know MongoDB has a maximum storage size for a document. If you plan to save a couple high-res images in that document you will go better with a file storage.

Azure Custom Vision: Is it possible to store image metadata (NOT tags) in the Custom Vision environment?

I have images with important file metadata (e.g. provenance and processing history) stored locally or in Azure blob storage.
I would like to import (POST) these to the Azure Custom Vision environment (via the API or GUI) (see e.g. https://southcentralus.dev.cognitive.microsoft.com/docs/services/Custom_Vision_Training_3.0) for training while (i) retaining those image metadata and (ii) being able to retrieve them via (a) the Custom Vision API and (b) the Custom Vision GUI.
An example use case would be to purge images of a certain provenance from the Custom Vision store because of a GDPR-related customer request [Aside: I appreciate that Azure Cognitive Services can anyway use the data for improving their models etc.].
As far as I can tell the only way to reference an image POSTed to Custom Vision is via its UUID. Is there any other way to reference metadata stored with that image or:
Would that constitute a feature request?
Could the image metadata be stored inside the image (e.g. JPEG EXIF) (assuming it is possible to retrieve the image itself from the Custom Vision "environment", which it may not be)?
Otherwise, is the only solution to store the returned Custom Vision image UUID in a database elsewhere alongside the required metadata?
NB In the above, by metadata I do not mean tags/labels in the image model-side sense, but rather data-side file metadata.
[Note that Azure Cognitive Services is using stackoverflow for Q&A, so this question is I believe appropriate for stackoverflow.]
Thanks as ever!
I am not part of Microsoft, so it is only my opinion based on my usage of Custom Vision.
I understand your use-case, especially regarding GDPR as you mentioned, but currently adding metadata is not a feature, whether through the API or the GUI.
To answer your questions:
Would that constitute a feature request?
Definitely. You can create an item on UserVoice for this feature (but 1st check if there is not another related existing item): https://cognitive.uservoice.com/forums/598141-custom-vision-service
Could the image metadata be stored inside the image (e.g. JPEG EXIF)
(assuming it is possible to retrieve the image itself from the Custom
Vision "environment", which it may not be)?
You can get the images your previously posted using GetImagesByIds method from the API for example (or GetTaggedImages / GetUntaggedImages). Remember that the images you post are treated: thumbnail images, resized images are generated based on what you posted. These methods provides the links to the images.
I made a quick try by:
- Uploading an image to CustomVision and adding a tag
- Getting its id
- Getting the image through the API
Good news: on the image downloaded with the "originalImageUri" link, I still have some EXIF available (just needed to rename the file as ".jpg" after download):
Otherwise, is the only solution to store the returned Custom Vision
image UUID in a database elsewhere alongside the required metadata?
Right now it is clearly the best solution in my opinion

Use Google map tiles in Cartopy

It seems fetching Google tiles directly isn't supported very well by Google via normal API access (even with an API key).
Hence, cartopy.io.img_tiles.GoogleTiles doesn't work well as it is able to fetch tiles only for one or two trials after which the requests start getting denied by Google.
What's the recommended way of using Google Maps with Cartopy?
Thanks
Instead of using Google map tiles, I am using Mapbox static tiles API and it seems to be working well. They are currently offering 50,000 calls to the API for free (even for commercial use).
I have monkey patched GoogleWTS.get_image function as described here to update the URL and storing tiles in a local cache (which I delete every week to get fresh data): https://github.com/SciTools/cartopy/issues/1341#issuecomment-511116060.

Using SuiteScript to extract metadata from Images in the file cabinet

I'm looking to build a particular solution for a client which needs to dynamically resize images stored in the Netsuite file cabinet.
Is there any way within suitescript/netsuite to grab the width and height of an image in the file cabinet?
Cheers!
SuiteScript is basically javascript so if you can find any third party library that does this, you can add that.
I don't know if you can do this with SuiteScript, but you can do it via Web Services. If you do a "get" on each image file with PHP, you can then use the PHP getimagesize function to get the image dimensions.
Netsuite doesn't have anything native for this but a simple-ish solution would be to create a node app on AWS Lambda that accepts an image and resizes it.
You can't deploy a user event script on images so you'd be stuck with a scheduled script or a map reduce script. You can feed that with a list of images created since some date/time or you could set a User Note when the image has been resized and filter against that.
I've used the node package 'sharp' for this sort of thing and the speed and quality are good.

Vuforia Cloud Database Target with custom content [duplicate]

I am trying to use vuforia framework (https://developer.vuforia.com/library/all-articles) to do a simple image recognition task via cloud. My question is that is it possible to take an image from camera and search it in vuforia cloud (without realtime frame processing - AR) ? They have very limited documentation and could not find any relevant information regarding this.
Vuforia now allows us to upload objects into the target manager, whether it is an image or cylinder/box, or even a multiple dimension object.
Upload these into Vuforia Database (Database should be for cloud reco. If not, create a new database for it) and get the Client Keys.
Now you can import the Cloud reco prefab and add a text on top to augment.
Hope this helped. :)

Resources