How convert the image into binary (BLOB) before passing it as a paramater? - ng-file-upload

I am using the plugin provided here . I want to convert the image into binary formate before I pass it as a parameter to the service. How can I do the using this plugin? Is it possible?

Related

Want to convert String into json object in flutter

[{insert: comming comming}, {insert:
, attributes: {list: ordered}}]
getting this string response from backend. I want to convert it in a json object , not in json string.
I am using flutterQuill editor for rich text , so I want the string as json object , so that I can use it on the flutter quill
you should read this:
https://docs.flutter.dev/development/data-and-backend/json
Basic JSON serialization in Flutter is very simple. Flutter has a built-in dart:convert library that includes a straightforward JSON encoder and decoder.
There are also examples.
Have you checked the official flutter Docs? This is the link: dart-convert -jsonEncode
In there, you can find how it is done.

Inputfield information to image Unity

Hi everyone dose anybody know in what format data is generated in input field? What i really need to do is take information from input field and generate image with the same text.
Its a string, to get it
string textToParse = gameObjectThatHasInputField.GetComponent<InputField>().text;
If you put resources in resource folder you can generate with Resources.Load
https://docs.unity3d.com/ScriptReference/Resources.Load.html

Convert mbgl-offline db to mbtiles

I'm trying to implement mapbox offline in my flutter application... until now I'm using the repository https://github.com/mapbox/mapbox-gl-native to get the map but this map comes in format *.db which is a SQLite format.
Now if I want to use that map (in format .db) in flutter I found the package https://github.com/tobrun/flutter-mapbox-gl where it has an instructions for loading the map (.db) ...
Now, that library is so basic .. I can't do more things like put markers or anything else.. that's why I'm trying to use the other library which is more common in fluter and is called 'flutter_map' and it has a way to load offline maps but the problem here is that I need '{x}{y}{z}.png' that's an image format.
Finally my question is: How can I pass from my map (.db) to that format ({x}{y}{z}.png) ??? or maybe ... how to convert (.db) to (*.mbtiles) ?? cause the last one is more common.
Thanks again!
Mapbox offers the Raster Tiles API which will serve map tiles in ({x}{y}{z}.png) format. https://docs.mapbox.com/api/maps/#raster-tiles These images will be satellite imagery though.
Mapbox also offers the Vector Tiles API which serves map tiles in .mvt format.
https://docs.mapbox.com/api/maps/#vector-tiles
Conversion to .mbtiles
You can convert .mvt tiles to geoJSON using this converter.
Use Mapbox Tippecanoe to convert from geoJSON to .mbtiles

MATLAB: websave function doesn't save the image

I am using the following function to save map from mapquest as a png file as follows
f_name='abc.png';
url='https://www.mapquest.com?center=1.34,103.683'
%other parameters also go through the url.
websave(f_name, url);
Image is saved but it cannot be displayed throwing the following error.
Error using imread>get_format_info (line 543)
Unable to determine the file format.
Error in imread (line 391)
fmt_s = get_format_info(fullname);
Subsequently following line also throws an error.
[M, Mcolor] = imread(filepath);
When image is opened a message is displayed
File format is not supported.
But if its extension is changed for example to html it does try to load the actual web page display.
Any clues will be highly appreciated
Finally I managed to find the way to do this after a little research!
Static APIs are used in this regard and are available with maps like Google, Mapquest etc.
These static APIs convert the web page of map to its respective image, to put an example for Mapquest it can be used using this

How to load an SVG and a referenced PNG from a REST service at the same time?

I'm trying to create a web service in PHP that can deliver an SVG with reference to a PNG raster image. Both the data for the SVG as well as the binary PNG image come from a MySQL database on the server.
Option A: Encode the PNG data in base-64 and embed it directly in the SVG, such as:
<image xlink:href="data:image/png;base64,..."/>
Concerns: 30% heavier load than loading it as pure binary and noticeable delay when loading it with Postman (or is this just because of Postman).
Option B: Call the PNG data as binary and save it as a file on the file system, then call the SVG file, which would then reference the physical PNG file.
Concerns: Involvement of the file system (which implies I need to start managing physical files, expiration dates etc).
Is there perhaps another way that an SVG can reference the binary data on the fly without it having to be on the file system?
To accomplish something similar (in my case sending data for SVGs with additional data about each file as binary files, which are much smaller than sending xml, text, or json) - I use CBOR. In my case, I compress the SVG using LZString compression first, and add this along with additional data attributes to a JSON object. Then I convert the JSON object to CBOR. I think CBOR can handle your base 64 data without any need for conversion - more information about it is here: cbor.io
I found a PHP library for CBOR here: https://github.com/2tvenom/CBOREncode
This may not be the way to go at all for you, but I thought I'd throw it out there just in case.