How can I export Image as 3DL or Cube File? - swift

I'm using a png filter to filter a video/image but at the end I want the user to have export options.
So save video as mp4, photo as jpg/png etc
But I also need the user to save the filtered file as a 3DL and Cube file
Basically, 3DL files are used as LUTS/lookuptables in Adobe Premiere and Cube files are used as LUTS in DaVinci Resolve and FCPX.
But cube files also use two different sizes, 17x17x17 for FCPX and 33X33X33 for Resolve.
Any ideas how to save as 3dl and cube files?
Using Swift

Related

Access folder from desktop to MATLAB online through code

I am not able to access folder from Downloads folder to MATLAB online version and even if I make folder of images in MATLAB online, even then it is not accessing.
I have 20 images in my folder and want to make all of them read in a variable (struct variable with fields) in MATLAB online compiler
Actually I have a folder of images in Downloads folder and want to access it in MATLAB online version, but not able to do it. I tried:
images=dir('C:\Users..........\im_patching\data_10pair')
By using breakpoints, it is seen that it is not storing any name and description of images.
It is giving : 0*1 empty struct array with fields name, folder, date, bytes, isdir, datenum
and Secondly, if I make the folder inside the MATLAB online version only and access it like
eg. Path to the images in matlab online compiler is
/MATLAB Drive/2017_CNN/patching/data_10pair/a.jpg.... (all 20 images)
now to access all the images a.jpg, b.jpg......
the MATLAB code line is
images = /2017_CNN/patching/data_10pair
after applying breakpoints it gives : 1*29 char
I want to make the "images" variable read all the names of images with the fields
My folder has 20 images.
Kindly help, I am new to MATLAB.

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.

PDF file stored as BLOB, view in a webpage perl

I have a code that handles displaying a blob from a local Oracle database. I store both JPG and PDF files as blob. I could view the JPG file, but not the PDF. I have checked these
$self->content_type('image/jpg')
to
$self->content_type('application/pdf').
And the Blob does have data. I checked the length and it has "184546".
All I get when I click the link for the pdf file is a blank page with the title GETIMAGPAGE(application/pdf).
Any help or pointers would be greatly appreciated.
Also, How can we have the content_type to enable two different mime_types? For example in my case both image as well as pdf, depending on what we get?
File::MMagic can recognize the type of data using magic numbers.
use File::MMagic;
$magic = File::MMagic->new;
$self->content($blob);
$self->content_type($magic->checktype_contents($blob));
If you don't want to require a native/plugin PDF reader, perhaps FlexPaper might fit your needs.

How to create new demon.model in openGLES?

I want to create a rotating object with 3d effect , I am using the sample project iPhoneGLEssentials provided by developer.apple.com. In the sample project demon.model file is used , I need to create my own .model file. Can any one help me how to create the required .model file?
You can see from the source for that demo that's not a common format. It just has the arrays for positions, normals, texcoords and element indices. You can see how it is read from the .model file in the moduleUtil.h. You can search online for libraries that can load specific formats for models. Engines like irrlicht has support for many formats such as .3ds, and .x. You can start from checking there.

storing & reading xml files iPhone

I am using text-editor to store xml files.
I know how to read xml files in iPhone application. But the problem which do i get is explained below.
When I store xml files through text-editors, it looks perfect.
But when iPhone - xCode debugs, xml file data is shown as below.
What kind of mistake have I Done?
{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf460
{\fonttbl\f0\fmodern\fcharset0 Courier-Bold;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\ql\qnatural\pardirnatural
\f0\b\fs24 \cf0 \CocoaLigature0 \
Play Your ShotEvery golfer likes to hit the ball long, high and straight, but experience tells you that you can expect a certain pattern to your shots.Shots Curve From Sidehill LiesSidehill fairway lies will cause the ball to curve, slice right or hook left. Here's a tip to help make better contact.Don't Ground The DriverKeep the clubhead just off the ground to get your swing off to a consistently smooth start.Tilt Your TeeHere's a tip to "max out" into-the-wind drives.}
Above given data isn't my xml file.
I tried to save my xml file through textEditor.
But it prefix something before my xml data.
What should be done by me to avoid this problem?
my actual xml data is following.
<?xml version="1.0" encoding="ISO-8859-1"?>\
<tips><Prop_Tips><Tip_ID><![CDATA[1]]></Tip_ID><Tip_Title>Play Your Shot</Tip_Title><Tip_Description>Every golfer likes to hit the ball long, high and straight, but experience tells you that you can expect a certain pattern to your shots.</Tip_Description></Prop_Tips><Prop_Tips><Tip_ID><![CDATA[2]]></Tip_ID><Tip_Title>Shots Curve From Sidehill Lies</Tip_Title><Tip_Description>Sidehill fairway lies will cause the ball to curve, slice right or hook left. Here's a tip to help make better contact.</Tip_Description></Prop_Tips><Prop_Tips><Tip_ID><![CDATA[3]]></Tip_ID><Tip_Title>Don't Ground The Driver</Tip_Title><Tip_Description>Keep the clubhead just off the ground to get your swing off to a consistently smooth start.</Tip_Description></Prop_Tips><Prop_Tips><Tip_ID><![CDATA[4]]></Tip_ID><Tip_Title>Tilt Your Tee</Tip_Title><Tip_Description>Here's a tip to "max out" into-the-wind drives.</Tip_Description></Prop_Tips></tips>
Seems like you have written your XML file in a Rich Text Editor. It is saving the file in .rtf format, instead of raw text/xml.
Maybe the editor you are using has the option to save as raw txt. That should solve it.
You could also create the file using XCode. It will surely use raw txt.
Are you editing your XML file with TextEdit or something? You've got a whole bunch of RTF data in there, which would seem to imply that you're overwriting your XML data with RTF'd XML. Try using a text editor like Property List Editor or TextWrangler instead.