How do I determine if a file is a GIF or webp? - gif

I have a file that's .gif extension but I suspect that it's a lie and it's actually a webp. What's the best way to know what format the file is?

By looking into file content and checking its magic number. For webp it's WEBP and for GIF file it is GIF87a/GIF89a.
Here you have list of all magic numbers and where it is located in file: https://en.wikipedia.org/wiki/List_of_file_signatures

You can use TrID, an application that uses file contents to determine file type.

Related

Not able to rendered css file content when use as a local file but it is working when used from url itself

I want to use font-awesome.min.css file which was downloaded on my local system.
I am trying to use it but expected results not rendered. but if i use "https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" then expected results rendered .
may i know why it is happening like this ?
I dont want to hit the url i just want to use file from local path.
You also need to have the font file for fontawesome, in my case, it's named
fontawesome-webfont.woff2
Placed in a fonts folder besides your folder that contains the fontawesome css

How is Chrome SingleFile format achieved?

Chrome has an extension called SingleFile. It basically saves a web page in a one file *.htm page that is a clone of the original website. I have seen something like this done with Mozilla MAFF format. The MAFF format saves the file in *.maf, and is you want to see contents (html, css, images etc.) you can change the format to *.zip. Then you can unzip it. With the SingleFile (Chrome) you can’t unzip the file by changing extension. Does anybody know how this is achieved? Is this a known thing that *.htm can offer? Thanks
The MAFF format saves the file in *.maf, and is you want to see
contents (html, css, images etc.) you can change the format to *.zip.
Then you can unzip it.
I'm assuming that you're really asking just how the image files are stored in .htm since html and css can easily be stored as text in htm.
It uses uuencode/uudecode to embed image files in the .htm file. More on that here:
https://en.wikipedia.org/wiki/Uuencoding
This is why changing the extension to .zip won't turn the file into a zip package that you can unzip.
Illustrative side-by-side screenshots of external vs. embedded image.
I found this article may help: http://www.techgainer.com/enable-single-file-mhtml-support-chrome/
On Chrome address bar, type chrome://flags, then hit enter. Now use Ctrl+F (Command+F on Mac) bring search bar and search for mhtml as I did below. Once you find the option, click on Enable link.

Extract Base64 data sets from a Swiffy file

Extract Base64 data sets from a Swiffy file
Anyone had experience with this? I had a swf file converted to html and all my images have been converted into base64 in one document.
how can i extract all the images from the html is there a program that can detect base 64 or at least detect multiple images in a html/txt file?
I just extracted from a Swiffy HTML file an MP3 file encoded as base64:
http://www.casedasole.it/testing/swiffy.html
...like this:
opened HTML file in Textpad and searched for "base64"
found this: "data:audio/mpeg;base64,fQb/4yDAA [etc., ending with] CAAIAAgAAA\u003d" (all between one set of quote marks)
copied from fQb/ down to AAgAAA (ignored \u003d")
pasted text into http://www.freeformatter.com/base64-encoder.html, clicked DECODE
was prompted with "A binary file can't be displayed inline and you will therefore be prompted to save the output as a file attachment", clicked yes, downloaded file, and added extension .mp3 to the downloaded file
It plays (in desktop FF and Chrome, with autoplay)! http://www.casedasole.it/testing/swiffy-base64.html
It wasn't an image, but with the same procedure you should be able to spot and extract images. Lemme know.

How do you get the files type/extension based on the file content in ActionScript?

How do you get the file type/extension based on the file content in ActionScript? For example I have a jpg image with the following file name: niceimage. Just based on the file name, I won't know whats the files extension but for me it's important to know the exact type of the image.
You have to read in the binary data (https://www.google.com/search?q=read+binary+file+in+as3) and parse the image header yourself.
There are also libraries out there (such as http://www.greensock.com/loadermax/) that can help if you only care about loading the content to your scene.

use actionscript to convert favicon to png?

Using actionscript 3, how can I convert the favicon of a website to a 16x16 .png file?
this solution must specifically NOT access online services such as http://www.google.com/s2/favicons?domain=
The approach I would take is to bring in the ico file (assuming your favicons are ico files) as BitmapData. Then format the bitmap data as a PNG file. Here are some links I found to do just that. Alternatively, you could build your own solution but that would certainly be the long way round.
Importing ico files as bitmaps:
http://ntt.cc/2008/10/02/using-icodecoder-class-to-read-ico-file-and-display-it-as-bitmap-in-actionscript.html
Generating a PNG file from bitmap data:
http://www.kaourantin.net/2005/10/png-encoder-in-as3.html