file-format

How to identify the file content as ASCII or binary

三世轮回 提交于 2019-11-26 21:51:36
How do you identify the file content as being in ASCII or binary using C++? If a file contains only the decimal bytes 9–13, 32–126, it's probably a pure ASCII text file. Otherwise, it's not. However, it may still be text in another encoding. If, in addition to the above bytes, the file contains only the decimal bytes 128–255, it's probably a text file in an 8-bit or variable-length ASCII-based encoding such as ISO-8859-1, UTF-8 or ASCII+Big5. If not, for some purposes you may be able to stop here and consider the file to be binary. However, it may still be text in a 16- or 32-bit encoding. If

How to split an animated gif in .net?

萝らか妹 提交于 2019-11-26 21:40:26
问题 How do you split an animated gif into its component parts in .net? Specifically I want to load them into Image(s) (System.Drawing.Image) in memory. ====================== Based on SLaks' answer i now have this public static IEnumerable<Bitmap> GetImages(Stream stream) { using (var gifImage = Image.FromStream(stream)) { //gets the GUID var dimension = new FrameDimension(gifImage.FrameDimensionsList[0]); //total frames in the animation var frameCount = gifImage.GetFrameCount(dimension); for

Extracting text from garbled PDF [closed]

こ雲淡風輕ζ 提交于 2019-11-26 20:15:45
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I have a PDF file with valuable textual information. The problem is that I cannot extract the text, all I get is a bunch of garbled symbols. The same happens if I copy and paste the text from the PDF reader to a text file. Even File -> Save as text in Acrobat Reader fails. I have used all tools I could get my

Reading PSD file format

主宰稳场 提交于 2019-11-26 19:09:49
问题 I wonder if this is even possible. I have an application that adds a context menu when you right click a file. It all works fine but here is what I'd like to do: If the file is a PSD then I want the program to extract the image. Is this possible to do without having Photoshop installed? Basically I want the user to right click and click "image" which would save a .jpg of the file for them. edit: will be using c# Thanks 回答1: For people who are reading this now: the link from accepted answer

What is the difference between “JPG” / “JPEG” / “PNG” / “BMP” / “GIF” / “TIFF” Image?

夙愿已清 提交于 2019-11-26 15:01:07
问题 I have seen many types of image extensions but have never understood the real differences between them. Are there any links out there that clearly explain their differences? Are there standards to consider when choosing a particular type of image to use in an application? What do we use for web applications? 回答1: Yes. They are different file formats (and their file extensions). Wikipedia entries for each of the formats will give you quite a bit of information: JPEG (or JPG, for the file

How to find where does Image Block start in GIF images?

穿精又带淫゛_ 提交于 2019-11-26 14:51:58
问题 Information source - http://www.onicos.com/staff/iz/formats/gif.html#header In GIF images the actual image size (width, height) is stored in Image Block. To my best understanding Image Block is the very first block included in header. Before the actual blocks begin, there is a memory allocation called Global Color Table (0..255 x 3 bytes)(from now-on GCT ). If I can know the byte count reserved for GCT I can extract bytes 5-9 from Image Block and have the actual image size. Question: How can

Load Jpg/Gif/Bitmap and convert to Bitmap

♀尐吖头ヾ 提交于 2019-11-26 10:34:36
问题 I have to load an image from an XML file. There is no information in the XML file about whether the image is JPG/GIF/BMP. After loading the image, I need to convert it to Bitmap. Does anyone have any clue how to convert images to Bitmap without knowing the actual file format? I\'m using Delphi 2007/2009 Thank you. 回答1: Delphi 2009 comes with built in support for JPEG, BMP, GIF and PNG. For earlier versions of Delphi you may need to find third party implementations for PNG and GIF, but in

Why am I getting mime-type of .csv file as “application/octet-stream”?

余生长醉 提交于 2019-11-26 09:43:53
问题 I\'m working on a PHP application that must import an excel file into MySQL. So I need to convert the excel file to .csv format. But when I want to get its type using $_FILE[\'something\'][\'type\'] , I get application/octet-stream as its mime-type; I think there is something wrong here. Because I gathered the list below as a .csv file mime-type: text/comma-separated-values, text/csv, application/csv, application/excel, application/vnd.ms-excel, application/vnd.msexcel What\'s the matter ?

Write a file in UTF-8 using FileWriter (Java)?

こ雲淡風輕ζ 提交于 2019-11-26 08:07:14
问题 I have the following code however, I want it to write as a UTF-8 file to handle foreign characters. Is there a way of doing this, is there some need to have a parameter? I would really appreciate your help with this. Thanks. try { BufferedReader reader = new BufferedReader(new FileReader(\"C:/Users/Jess/My Documents/actresses.list\")); writer = new BufferedWriter(new FileWriter(\"C:/Users/Jess/My Documents/actressesFormatted.csv\")); while( (line = reader.readLine()) != null) { //If the line

Tools to help reverse engineer binary file formats

不打扰是莪最后的温柔 提交于 2019-11-26 07:53:52
问题 What tools are available to aid in decoding unknown binary data formats? I know Hex Workshop and 010 Editor both support structures. These are okay to a limited extent for a known fixed format but get difficult to use with anything more complicated, especially for unknown formats. I guess I\'m looking at a module for a scripting language or a scriptable GUI tool. For example, I\'d like to be able to find a structure within a block of data from limited known information, perhaps a magic number