├── QRdecode
├── app.js
├── chrome-plus
│ ├── background.html
│ ├── cinfo.html
│ ├── decode-128.png
│ ├── decode-16.png
│ ├── decode-19.png
│ ├── decode-48.png
│ ├── imageinfo
│ │ ├── binaryajax.js
│ │ ├── exif.js
│ │ ├── imageinfo.js
│ │ └── readme.txt
│ ├── info.html
│ └── manifest.json
└── views
│ └── index.jade
└── README.md
/QRdecode/app.js:
--------------------------------------------------------------------------------
1 | //some model require
2 | var express = require('express'),
3 | req = require('request'),
4 | fs = require('fs'),
5 | app = module.exports = express.createServer();
6 |
7 | //app config
8 | app.configure(function(){
9 | app.set('views', __dirname + '/views');
10 | app.set('view engine', 'jade');
11 | app.use(express.bodyParser());
12 | app.use(express.static(__dirname + '/public'));
13 | app.set('view options', {
14 | layout: false
15 | });
16 | });
17 |
18 | //index for introduce and example
19 | app.get('/', function(require, response){
20 | response.render('index');
21 | });
22 | app.post('/decode/*', function(require, response){
23 | var reg_header = /^chrome-extension:/;
24 | if (reg_header.test(require.headers.origin)) {
25 | console.log(require.headers.origin + '======================' + Date() + "===================");
26 | var img = require.body.img, name = Math.floor(Math.random() * 100) + '.png', reg_base64 = /base64/, reg_pic = /^/;
27 | if (reg_base64.test(img)) {//data-uri pic
28 | var str = img.split(';base64,');
29 | fs.writeFile('public/' + name, new Buffer(str[1], 'base64'), function(err){
30 | if (err)
31 | throw err;
32 | decode(name);
33 | });
34 |
35 | }
36 | else {//url pic
37 | console.log('img======' + img);
38 | req.get({
39 | uri: img,
40 | encoding: 'binary',
41 | timeout: 15000
42 | }, function(err, resp, body){
43 | fs.writeFile('public/' + name, body, encoding = 'binary', function(err){
44 | if (err)
45 | throw err;
46 | decode(name);
47 | });
48 | });
49 | }
50 | function decode(img){
51 | var url = 'http://zxing.org/w/decode?u=';//decode API
52 | url += encodeURIComponent('http://204.12.225.114/' + img);//temp pic for data-uri pic or to long url pic
53 | console.log('url=======' + url);
54 | req(url, function(error, res, body){
55 | if (!error && res.statusCode == 200) {
56 | reg_pic.test(body) || reg_err.test(body) ? body = '无法识别!' : body = body.trim();
57 | console.log(body);
58 | resText(body);
59 | fs.unlink('public/' + name, function(err){//remove temp pic
60 | if (err)
61 | throw err;
62 | });
63 | }
64 | });
65 | }
66 | }
67 | else {
68 | resText('非法请求!');
69 | }
70 | function resText(text){
71 | response.charset = 'utf-8';
72 | response.header('Content-Type', 'text/html');
73 | response.write(text);
74 | response.end();
75 | }
76 | });
77 | app.listen(80);
78 | console.log('Server running');
79 |
--------------------------------------------------------------------------------
/QRdecode/chrome-plus/background.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/QRdecode/chrome-plus/cinfo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | 二维码URL |
49 | |
50 |
51 |
52 | 二维码信息 |
53 | |
54 |
55 |
56 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/QRdecode/chrome-plus/decode-128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqiang/QRdecode/4af2199f8d09c572a2ec5548c2ee4a10850ed8b2/QRdecode/chrome-plus/decode-128.png
--------------------------------------------------------------------------------
/QRdecode/chrome-plus/decode-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqiang/QRdecode/4af2199f8d09c572a2ec5548c2ee4a10850ed8b2/QRdecode/chrome-plus/decode-16.png
--------------------------------------------------------------------------------
/QRdecode/chrome-plus/decode-19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqiang/QRdecode/4af2199f8d09c572a2ec5548c2ee4a10850ed8b2/QRdecode/chrome-plus/decode-19.png
--------------------------------------------------------------------------------
/QRdecode/chrome-plus/decode-48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqiang/QRdecode/4af2199f8d09c572a2ec5548c2ee4a10850ed8b2/QRdecode/chrome-plus/decode-48.png
--------------------------------------------------------------------------------
/QRdecode/chrome-plus/imageinfo/binaryajax.js:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * Binary Ajax 0.1.5
4 | * Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/
5 | * MIT License [http://www.opensource.org/licenses/mit-license.php]
6 | */
7 |
8 |
9 | var BinaryFile = function(strData, iDataOffset, iDataLength) {
10 | var data = strData;
11 | var dataOffset = iDataOffset || 0;
12 | var dataLength = 0;
13 |
14 | this.getRawData = function() {
15 | return data;
16 | }
17 |
18 | if (typeof strData == "string") {
19 | dataLength = iDataLength || data.length;
20 |
21 | this.getByteAt = function(iOffset) {
22 | return data.charCodeAt(iOffset + dataOffset) & 0xFF;
23 | }
24 | } else if (typeof strData == "unknown") {
25 | dataLength = iDataLength || IEBinary_getLength(data);
26 |
27 | this.getByteAt = function(iOffset) {
28 | return IEBinary_getByteAt(data, iOffset + dataOffset);
29 | }
30 | }
31 |
32 | this.getLength = function() {
33 | return dataLength;
34 | }
35 |
36 | this.getSByteAt = function(iOffset) {
37 | var iByte = this.getByteAt(iOffset);
38 | if (iByte > 127)
39 | return iByte - 256;
40 | else
41 | return iByte;
42 | }
43 |
44 | this.getShortAt = function(iOffset, bBigEndian) {
45 | var iShort = bBigEndian ?
46 | (this.getByteAt(iOffset) << 8) + this.getByteAt(iOffset + 1)
47 | : (this.getByteAt(iOffset + 1) << 8) + this.getByteAt(iOffset)
48 | if (iShort < 0) iShort += 65536;
49 | return iShort;
50 | }
51 | this.getSShortAt = function(iOffset, bBigEndian) {
52 | var iUShort = this.getShortAt(iOffset, bBigEndian);
53 | if (iUShort > 32767)
54 | return iUShort - 65536;
55 | else
56 | return iUShort;
57 | }
58 | this.getLongAt = function(iOffset, bBigEndian) {
59 | var iByte1 = this.getByteAt(iOffset),
60 | iByte2 = this.getByteAt(iOffset + 1),
61 | iByte3 = this.getByteAt(iOffset + 2),
62 | iByte4 = this.getByteAt(iOffset + 3);
63 |
64 | var iLong = bBigEndian ?
65 | (((((iByte1 << 8) + iByte2) << 8) + iByte3) << 8) + iByte4
66 | : (((((iByte4 << 8) + iByte3) << 8) + iByte2) << 8) + iByte1;
67 | if (iLong < 0) iLong += 4294967296;
68 | return iLong;
69 | }
70 | this.getSLongAt = function(iOffset, bBigEndian) {
71 | var iULong = this.getLongAt(iOffset, bBigEndian);
72 | if (iULong > 2147483647)
73 | return iULong - 4294967296;
74 | else
75 | return iULong;
76 | }
77 | this.getStringAt = function(iOffset, iLength) {
78 | var aStr = [];
79 | for (var i=iOffset,j=0;i\r\n"
228 | + "Function IEBinary_getByteAt(strBinary, iOffset)\r\n"
229 | + " IEBinary_getByteAt = AscB(MidB(strBinary,iOffset+1,1))\r\n"
230 | + "End Function\r\n"
231 | + "Function IEBinary_getLength(strBinary)\r\n"
232 | + " IEBinary_getLength = LenB(strBinary)\r\n"
233 | + "End Function\r\n"
234 | + "\r\n"
235 | );
236 |
--------------------------------------------------------------------------------
/QRdecode/chrome-plus/imageinfo/exif.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Javascript EXIF Reader 0.1.2
3 | * Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/
4 | * MIT License [http://www.opensource.org/licenses/mit-license.php]
5 | */
6 |
7 |
8 | var EXIF = {};
9 |
10 | (function() {
11 |
12 | var bDebug = false;
13 |
14 | EXIF.Tags = {
15 |
16 | // version tags
17 | 0x9000 : "ExifVersion", // EXIF version
18 | 0xA000 : "FlashpixVersion", // Flashpix format version
19 |
20 | // colorspace tags
21 | 0xA001 : "ColorSpace", // Color space information tag
22 |
23 | // image configuration
24 | 0xA002 : "PixelXDimension", // Valid width of meaningful image
25 | 0xA003 : "PixelYDimension", // Valid height of meaningful image
26 | 0x9101 : "ComponentsConfiguration", // Information about channels
27 | 0x9102 : "CompressedBitsPerPixel", // Compressed bits per pixel
28 |
29 | // user information
30 | 0x927C : "MakerNote", // Any desired information written by the manufacturer
31 | 0x9286 : "UserComment", // Comments by user
32 |
33 | // related file
34 | 0xA004 : "RelatedSoundFile", // Name of related sound file
35 |
36 | // date and time
37 | 0x9003 : "DateTimeOriginal", // Date and time when the original image was generated
38 | 0x9004 : "DateTimeDigitized", // Date and time when the image was stored digitally
39 | 0x9290 : "SubsecTime", // Fractions of seconds for DateTime
40 | 0x9291 : "SubsecTimeOriginal", // Fractions of seconds for DateTimeOriginal
41 | 0x9292 : "SubsecTimeDigitized", // Fractions of seconds for DateTimeDigitized
42 |
43 | // picture-taking conditions
44 | 0x829A : "ExposureTime", // Exposure time (in seconds)
45 | 0x829D : "FNumber", // F number
46 | 0x8822 : "ExposureProgram", // Exposure program
47 | 0x8824 : "SpectralSensitivity", // Spectral sensitivity
48 | 0x8827 : "ISOSpeedRatings", // ISO speed rating
49 | 0x8828 : "OECF", // Optoelectric conversion factor
50 | 0x9201 : "ShutterSpeedValue", // Shutter speed
51 | 0x9202 : "ApertureValue", // Lens aperture
52 | 0x9203 : "BrightnessValue", // Value of brightness
53 | 0x9204 : "ExposureBias", // Exposure bias
54 | 0x9205 : "MaxApertureValue", // Smallest F number of lens
55 | 0x9206 : "SubjectDistance", // Distance to subject in meters
56 | 0x9207 : "MeteringMode", // Metering mode
57 | 0x9208 : "LightSource", // Kind of light source
58 | 0x9209 : "Flash", // Flash status
59 | 0x9214 : "SubjectArea", // Location and area of main subject
60 | 0x920A : "FocalLength", // Focal length of the lens in mm
61 | 0xA20B : "FlashEnergy", // Strobe energy in BCPS
62 | 0xA20C : "SpatialFrequencyResponse", //
63 | 0xA20E : "FocalPlaneXResolution", // Number of pixels in width direction per FocalPlaneResolutionUnit
64 | 0xA20F : "FocalPlaneYResolution", // Number of pixels in height direction per FocalPlaneResolutionUnit
65 | 0xA210 : "FocalPlaneResolutionUnit", // Unit for measuring FocalPlaneXResolution and FocalPlaneYResolution
66 | 0xA214 : "SubjectLocation", // Location of subject in image
67 | 0xA215 : "ExposureIndex", // Exposure index selected on camera
68 | 0xA217 : "SensingMethod", // Image sensor type
69 | 0xA300 : "FileSource", // Image source (3 == DSC)
70 | 0xA301 : "SceneType", // Scene type (1 == directly photographed)
71 | 0xA302 : "CFAPattern", // Color filter array geometric pattern
72 | 0xA401 : "CustomRendered", // Special processing
73 | 0xA402 : "ExposureMode", // Exposure mode
74 | 0xA403 : "WhiteBalance", // 1 = auto white balance, 2 = manual
75 | 0xA404 : "DigitalZoomRation", // Digital zoom ratio
76 | 0xA405 : "FocalLengthIn35mmFilm", // Equivalent foacl length assuming 35mm film camera (in mm)
77 | 0xA406 : "SceneCaptureType", // Type of scene
78 | 0xA407 : "GainControl", // Degree of overall image gain adjustment
79 | 0xA408 : "Contrast", // Direction of contrast processing applied by camera
80 | 0xA409 : "Saturation", // Direction of saturation processing applied by camera
81 | 0xA40A : "Sharpness", // Direction of sharpness processing applied by camera
82 | 0xA40B : "DeviceSettingDescription", //
83 | 0xA40C : "SubjectDistanceRange", // Distance to subject
84 |
85 | // other tags
86 | 0xA005 : "InteroperabilityIFDPointer",
87 | 0xA420 : "ImageUniqueID" // Identifier assigned uniquely to each image
88 | };
89 |
90 | EXIF.TiffTags = {
91 | 0x0100 : "ImageWidth",
92 | 0x0101 : "ImageHeight",
93 | 0x8769 : "ExifIFDPointer",
94 | 0x8825 : "GPSInfoIFDPointer",
95 | 0xA005 : "InteroperabilityIFDPointer",
96 | 0x0102 : "BitsPerSample",
97 | 0x0103 : "Compression",
98 | 0x0106 : "PhotometricInterpretation",
99 | 0x0112 : "Orientation",
100 | 0x0115 : "SamplesPerPixel",
101 | 0x011C : "PlanarConfiguration",
102 | 0x0212 : "YCbCrSubSampling",
103 | 0x0213 : "YCbCrPositioning",
104 | 0x011A : "XResolution",
105 | 0x011B : "YResolution",
106 | 0x0128 : "ResolutionUnit",
107 | 0x0111 : "StripOffsets",
108 | 0x0116 : "RowsPerStrip",
109 | 0x0117 : "StripByteCounts",
110 | 0x0201 : "JPEGInterchangeFormat",
111 | 0x0202 : "JPEGInterchangeFormatLength",
112 | 0x012D : "TransferFunction",
113 | 0x013E : "WhitePoint",
114 | 0x013F : "PrimaryChromaticities",
115 | 0x0211 : "YCbCrCoefficients",
116 | 0x0214 : "ReferenceBlackWhite",
117 | 0x0132 : "DateTime",
118 | 0x010E : "ImageDescription",
119 | 0x010F : "Make",
120 | 0x0110 : "Model",
121 | 0x0131 : "Software",
122 | 0x013B : "Artist",
123 | 0x8298 : "Copyright"
124 | }
125 |
126 | EXIF.GPSTags = {
127 | 0x0000 : "GPSVersionID",
128 | 0x0001 : "GPSLatitudeRef",
129 | 0x0002 : "GPSLatitude",
130 | 0x0003 : "GPSLongitudeRef",
131 | 0x0004 : "GPSLongitude",
132 | 0x0005 : "GPSAltitudeRef",
133 | 0x0006 : "GPSAltitude",
134 | 0x0007 : "GPSTimeStamp",
135 | 0x0008 : "GPSSatellites",
136 | 0x0009 : "GPSStatus",
137 | 0x000A : "GPSMeasureMode",
138 | 0x000B : "GPSDOP",
139 | 0x000C : "GPSSpeedRef",
140 | 0x000D : "GPSSpeed",
141 | 0x000E : "GPSTrackRef",
142 | 0x000F : "GPSTrack",
143 | 0x0010 : "GPSImgDirectionRef",
144 | 0x0011 : "GPSImgDirection",
145 | 0x0012 : "GPSMapDatum",
146 | 0x0013 : "GPSDestLatitudeRef",
147 | 0x0014 : "GPSDestLatitude",
148 | 0x0015 : "GPSDestLongitudeRef",
149 | 0x0016 : "GPSDestLongitude",
150 | 0x0017 : "GPSDestBearingRef",
151 | 0x0018 : "GPSDestBearing",
152 | 0x0019 : "GPSDestDistanceRef",
153 | 0x001A : "GPSDestDistance",
154 | 0x001B : "GPSProcessingMethod",
155 | 0x001C : "GPSAreaInformation",
156 | 0x001D : "GPSDateStamp",
157 | 0x001E : "GPSDifferential"
158 | }
159 |
160 | EXIF.StringValues = {
161 | ExposureProgram : {
162 | 0 : "Not defined",
163 | 1 : "Manual",
164 | 2 : "Normal program",
165 | 3 : "Aperture priority",
166 | 4 : "Shutter priority",
167 | 5 : "Creative program",
168 | 6 : "Action program",
169 | 7 : "Portrait mode",
170 | 8 : "Landscape mode"
171 | },
172 | MeteringMode : {
173 | 0 : "Unknown",
174 | 1 : "Average",
175 | 2 : "CenterWeightedAverage",
176 | 3 : "Spot",
177 | 4 : "MultiSpot",
178 | 5 : "Pattern",
179 | 6 : "Partial",
180 | 255 : "Other"
181 | },
182 | LightSource : {
183 | 0 : "Unknown",
184 | 1 : "Daylight",
185 | 2 : "Fluorescent",
186 | 3 : "Tungsten (incandescent light)",
187 | 4 : "Flash",
188 | 9 : "Fine weather",
189 | 10 : "Cloudy weather",
190 | 11 : "Shade",
191 | 12 : "Daylight fluorescent (D 5700 - 7100K)",
192 | 13 : "Day white fluorescent (N 4600 - 5400K)",
193 | 14 : "Cool white fluorescent (W 3900 - 4500K)",
194 | 15 : "White fluorescent (WW 3200 - 3700K)",
195 | 17 : "Standard light A",
196 | 18 : "Standard light B",
197 | 19 : "Standard light C",
198 | 20 : "D55",
199 | 21 : "D65",
200 | 22 : "D75",
201 | 23 : "D50",
202 | 24 : "ISO studio tungsten",
203 | 255 : "Other"
204 | },
205 | Flash : {
206 | 0x0000 : "Flash did not fire",
207 | 0x0001 : "Flash fired",
208 | 0x0005 : "Strobe return light not detected",
209 | 0x0007 : "Strobe return light detected",
210 | 0x0009 : "Flash fired, compulsory flash mode",
211 | 0x000D : "Flash fired, compulsory flash mode, return light not detected",
212 | 0x000F : "Flash fired, compulsory flash mode, return light detected",
213 | 0x0010 : "Flash did not fire, compulsory flash mode",
214 | 0x0018 : "Flash did not fire, auto mode",
215 | 0x0019 : "Flash fired, auto mode",
216 | 0x001D : "Flash fired, auto mode, return light not detected",
217 | 0x001F : "Flash fired, auto mode, return light detected",
218 | 0x0020 : "No flash function",
219 | 0x0041 : "Flash fired, red-eye reduction mode",
220 | 0x0045 : "Flash fired, red-eye reduction mode, return light not detected",
221 | 0x0047 : "Flash fired, red-eye reduction mode, return light detected",
222 | 0x0049 : "Flash fired, compulsory flash mode, red-eye reduction mode",
223 | 0x004D : "Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",
224 | 0x004F : "Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",
225 | 0x0059 : "Flash fired, auto mode, red-eye reduction mode",
226 | 0x005D : "Flash fired, auto mode, return light not detected, red-eye reduction mode",
227 | 0x005F : "Flash fired, auto mode, return light detected, red-eye reduction mode"
228 | },
229 | SensingMethod : {
230 | 1 : "Not defined",
231 | 2 : "One-chip color area sensor",
232 | 3 : "Two-chip color area sensor",
233 | 4 : "Three-chip color area sensor",
234 | 5 : "Color sequential area sensor",
235 | 7 : "Trilinear sensor",
236 | 8 : "Color sequential linear sensor"
237 | },
238 | SceneCaptureType : {
239 | 0 : "Standard",
240 | 1 : "Landscape",
241 | 2 : "Portrait",
242 | 3 : "Night scene"
243 | },
244 | SceneType : {
245 | 1 : "Directly photographed"
246 | },
247 | CustomRendered : {
248 | 0 : "Normal process",
249 | 1 : "Custom process"
250 | },
251 | WhiteBalance : {
252 | 0 : "Auto white balance",
253 | 1 : "Manual white balance"
254 | },
255 | GainControl : {
256 | 0 : "None",
257 | 1 : "Low gain up",
258 | 2 : "High gain up",
259 | 3 : "Low gain down",
260 | 4 : "High gain down"
261 | },
262 | Contrast : {
263 | 0 : "Normal",
264 | 1 : "Soft",
265 | 2 : "Hard"
266 | },
267 | Saturation : {
268 | 0 : "Normal",
269 | 1 : "Low saturation",
270 | 2 : "High saturation"
271 | },
272 | Sharpness : {
273 | 0 : "Normal",
274 | 1 : "Soft",
275 | 2 : "Hard"
276 | },
277 | SubjectDistanceRange : {
278 | 0 : "Unknown",
279 | 1 : "Macro",
280 | 2 : "Close view",
281 | 3 : "Distant view"
282 | },
283 | FileSource : {
284 | 3 : "DSC"
285 | },
286 |
287 | Components : {
288 | 0 : "",
289 | 1 : "Y",
290 | 2 : "Cb",
291 | 3 : "Cr",
292 | 4 : "R",
293 | 5 : "G",
294 | 6 : "B"
295 | }
296 | }
297 |
298 | function addEvent(oElement, strEvent, fncHandler)
299 | {
300 | if (oElement.addEventListener) {
301 | oElement.addEventListener(strEvent, fncHandler, false);
302 | } else if (oElement.attachEvent) {
303 | oElement.attachEvent("on" + strEvent, fncHandler);
304 | }
305 | }
306 |
307 |
308 | function imageHasData(oImg)
309 | {
310 | return !!(oImg.exifdata);
311 | }
312 |
313 | function getImageData(oImg, fncCallback)
314 | {
315 | BinaryAjax(
316 | oImg.src,
317 | function(oHTTP) {
318 | var oEXIF = findEXIFinJPEG(oHTTP.binaryResponse);
319 | oImg.exifdata = oEXIF || {};
320 | if (fncCallback) fncCallback();
321 | }
322 | )
323 | }
324 |
325 | function findEXIFinJPEG(oFile) {
326 | var aMarkers = [];
327 |
328 | if (oFile.getByteAt(0) != 0xFF || oFile.getByteAt(1) != 0xD8) {
329 | return false; // not a valid jpeg
330 | }
331 |
332 | var iOffset = 2;
333 | var iLength = oFile.getLength();
334 | while (iOffset < iLength) {
335 | if (oFile.getByteAt(iOffset) != 0xFF) {
336 | if (bDebug) console.log("Not a valid marker at offset " + iOffset + ", found: " + oFile.getByteAt(iOffset));
337 | return false; // not a valid marker, something is wrong
338 | }
339 |
340 | var iMarker = oFile.getByteAt(iOffset+1);
341 |
342 | // we could implement handling for other markers here,
343 | // but we're only looking for 0xFFE1 for EXIF data
344 |
345 | if (iMarker == 22400) {
346 | if (bDebug) console.log("Found 0xFFE1 marker");
347 | return readEXIFData(oFile, iOffset + 4, oFile.getShortAt(iOffset+2, true)-2);
348 | iOffset += 2 + oFile.getShortAt(iOffset+2, true);
349 |
350 | } else if (iMarker == 225) {
351 | // 0xE1 = Application-specific 1 (for EXIF)
352 | if (bDebug) console.log("Found 0xFFE1 marker");
353 | return readEXIFData(oFile, iOffset + 4, oFile.getShortAt(iOffset+2, true)-2);
354 |
355 | } else {
356 | iOffset += 2 + oFile.getShortAt(iOffset+2, true);
357 | }
358 |
359 | }
360 |
361 | }
362 |
363 |
364 | function readTags(oFile, iTIFFStart, iDirStart, oStrings, bBigEnd)
365 | {
366 | var iEntries = oFile.getShortAt(iDirStart, bBigEnd);
367 | var oTags = {};
368 | for (var i=0;i 4 ? iValueOffset : (iEntryOffset + 8);
391 | var aVals = [];
392 | for (var n=0;n 4 ? iValueOffset : (iEntryOffset + 8);
401 | return oFile.getStringAt(iStringOffset, iNumValues-1);
402 | break;
403 |
404 | case 3: // short, 16 bit int
405 | if (iNumValues == 1) {
406 | return oFile.getShortAt(iEntryOffset + 8, bBigEnd);
407 | } else {
408 | var iValOffset = iNumValues > 2 ? iValueOffset : (iEntryOffset + 8);
409 | var aVals = [];
410 | for (var n=0;n= 4;
74 |
75 | return {
76 | format : "PNG",
77 | decode : "Decoding...",
78 | version : "",
79 | width : w,
80 | height : h,
81 | bpp : bpp,
82 | alpha : alpha,
83 | exif : {}
84 | }
85 | }
86 |
87 | function readGIFInfo(data) {
88 | var version = data.getStringAt(3,3);
89 | var w = data.getShortAt(6);
90 | var h = data.getShortAt(8);
91 |
92 | var bpp = ((data.getByteAt(10) >> 4) & 7) + 1;
93 |
94 | return {
95 | format : "GIF",
96 | decode : "Decoding...",
97 | version : version,
98 | width : w,
99 | height : h,
100 | bpp : bpp,
101 | alpha : false,
102 | exif : {}
103 | }
104 | }
105 |
106 | function readJPEGInfo(data) {
107 |
108 | var w = 0;
109 | var h = 0;
110 | var comps = 0;
111 | var len = data.getLength();
112 | var offset = 2;
113 | while (offset < len) {
114 | var marker = data.getShortAt(offset, true);
115 | offset += 2;
116 | if (marker == 0xFFC0) {
117 | h = data.getShortAt(offset + 3, true);
118 | w = data.getShortAt(offset + 5, true);
119 | comps = data.getByteAt(offset + 7, true)
120 | break;
121 | } else {
122 | offset += data.getShortAt(offset, true)
123 | }
124 | }
125 |
126 | var exif = {};
127 |
128 | if (typeof EXIF != "undefined" && EXIF.readFromBinaryFile) {
129 | exif = EXIF.readFromBinaryFile(data);
130 | }
131 |
132 | return {
133 | format : "JPEG",
134 | decode : "Decoding...",
135 | version : "",
136 | width : w,
137 | height : h,
138 | bpp : comps * 8,
139 | alpha : false,
140 | exif : exif
141 | }
142 | }
143 |
144 | function readBMPInfo(data) {
145 | var w = data.getLongAt(18);
146 | var h = data.getLongAt(22);
147 | var bpp = data.getShortAt(28);
148 | return {
149 | format : "BMP",
150 | decode : "Decoding...",
151 | version : "",
152 | width : w,
153 | height : h,
154 | bpp : bpp,
155 | alpha : false,
156 | exif : {}
157 | }
158 | }
159 |
160 | ImageInfo.loadInfo = function(url, cb) {
161 | if (!files[url]) {
162 | readFileData(url, cb);
163 | } else {
164 | if (cb) cb();
165 | }
166 | }
167 |
168 | ImageInfo.getAllFields = function(url) {
169 | if (!files[url]) return null;
170 |
171 | var tags = {};
172 | for (var a in files[url]) {
173 | if (files[url].hasOwnProperty(a))
174 | tags[a] = files[url][a];
175 | }
176 | return tags;
177 | }
178 |
179 | ImageInfo.getField = function(url, field) {
180 | if (!files[url]) return null;
181 | return files[url][field];
182 | }
183 |
184 |
185 | })();
186 |
187 |
--------------------------------------------------------------------------------
/QRdecode/chrome-plus/imageinfo/readme.txt:
--------------------------------------------------------------------------------
1 |
2 | ImageInfo - A JavaScript library for reading image metadata.
3 | Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/
4 | MIT License [http://www.nihilogic.dk/licenses/mit-license.txt]
5 |
6 | For detailed information and code samples please refer to the blog post at:
7 | http://blog.nihilogic.dk/2008/07/imageinfo-reading-image-info-with-javascript.html
8 |
--------------------------------------------------------------------------------
/QRdecode/chrome-plus/info.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
55 |
56 |
57 |
58 |
59 |
60 | 拖动二维码图片到本区域或者点击
61 |
62 |
63 |
64 |
65 |
66 | 二维码URL |
67 | |
68 |
69 |
70 | 二维码信息 |
71 | 解码中... |
72 |
73 |
74 |
194 |
195 |
196 |
--------------------------------------------------------------------------------
/QRdecode/chrome-plus/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name" : "二维码在线生成/解码工具",
3 | "version" : "1.2.2",
4 | "description" : "二维码在线生成/解码 by xiaoqiang.org",
5 | "background_page" : "background.html",
6 | "browser_action": {
7 | "default_icon": "decode-16.png",
8 | "default_title": "生成二维码"
9 | },
10 | "permissions" : [
11 | "browserAction",
12 | "contextMenus",
13 | "tabs",
14 | "http://*/*",
15 | "https://*/*"
16 | ],
17 | "minimum_chrome_version" : "6.0.0.0",
18 | "icons" : {
19 | "16" : "decode-16.png",
20 | "48" : "decode-48.png",
21 | "128" : "decode-128.png"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/QRdecode/views/index.jade:
--------------------------------------------------------------------------------
1 | !!!5
2 | html
3 | head
4 | meta(http-equiv="Content-Type", content="text/html; charset=utf-8")
5 | title="QRdecode"
6 | body
7 | img(src="http://www.xiaoqiang.org/wp-content/themes/xiaoqiang/images/x.png")
8 | P
9 | 功能介绍:1,能将网页上选中的文字生成二维码图片,并提供引用地址;2,能将网络上的二维码图片解码成文本信息;
适用场景:1,将网页上的有用信息转存到手机;2,将文字或者链接转成二维码发微博;3,在线解读网页上的二维码为文字或者链接;4,直接解读微博上别人发的二维码而不用掏手机;
10 | p
11 | 二维码生成使用方法:1,选中要生成的文本或链接;2,右击打开右键菜单,选择”将xxxx生成二维码”选项;3,弹出生成后的二维码信息页面;
12 | img(src="http://www.xiaoqiang.org/wp-content/uploads/2011/10/%E4%BA%8C%E7%BB%B4%E7%A0%81%E5%9C%A8%E7%BA%BF%E7%94%9F%E6%88%90%E6%88%AA%E5%9B%BE.jpg")
13 | p
14 | 二维码解码使用方法:1,在二维码图片上右击打开右键菜单,选择“二维码解码”选项;2,弹出二维码解码信息页面;
15 | img(src="http://www.xiaoqiang.org/wp-content/uploads/2011/10/%E4%BA%8C%E7%BB%B4%E7%A0%81%E5%9C%A8%E7%BA%BF%E8%A7%A3%E7%A0%81%E6%88%AA%E5%9B%BE.jpg")
16 | img(src="http://www.xiaoqiang.org/wp-content/uploads/2011/10/%E4%BA%8C%E7%BB%B4%E7%A0%81%E5%9C%A8%E7%BA%BF%E8%A7%A3%E7%A0%81%E7%BB%93%E6%9E%9C%E6%88%AA%E5%9B%BE.jpg")
17 | p
18 | 小技巧:二维码解码支持DATA-URI格式的图片
19 | p
20 | 2011-11-28更新:1,添加工具图标,点击图标,当前URL直接生成二维码;2,添加本地文件解码功能,将本地文件拖到浏览器中,右击弹出解码界面,由于浏览器的安全机制,必须手工拖动或者上传图片,方可解码;
21 | p
22 | a(href="http://www.xiaoqiang.org/demo/decode/QRdecode.crx", title="在线安装", tagert="_blank")
23 | 在线安装
24 | a(href="http://node.xiaoqiang.org", title="插件介绍地址", tagert="_blank")
25 | 插件介绍地址
26 | a(href="https://github.com/xiaoqiang/QRdecode", title="插件github地址", tagert="_blank")
27 | 插件github地址
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ###功能介绍:
2 | 1,能将网页上选中的文字生成二维码图片,并提供引用地址;2,能将网络上的二维码图片解码成文本信息;
3 | ###适用场景:
4 | 1,将网页上的有用信息转存到手机;2,将文字或者链接转成二维码发微博;3,在线解读网页上的二维码为文字或者链接;4,直接解读微博上别人发的二维码而不用掏手机;
5 | ###二维码生成使用方法:
6 | 1,选中要生成的文本或链接;2,右击打开右键菜单,选择”将xxxx生成二维码”选项;3,弹出生成后的二维码信息页面;
7 | ###二维码解码使用方法:
8 | 1,在二维码图片上右击打开右键菜单,选择“二维码解码”选项;2,弹出二维码解码信息页面;
9 | ###小技巧:
10 | 二维码解码支持DATA-URI格式的图片
11 | ###2011-11-28更新:
12 | 1,添加工具图标,点击图标,当前URL直接生成二维码;2,添加本地文件解码功能,将本地文件拖到浏览器中,右击弹出解码界面,由于浏览器的安全机制,必须手工拖动或者上传图片,方可解码;
13 | [在线安装](http://www.xiaoqiang.org/demo/decode/QRdecode.crx)
14 | [项目地址](http://node.xiaoqiang.org)
15 | [github地址](https://github.com/xiaoqiang/QRdecode)
--------------------------------------------------------------------------------