Separate final ts-exif-parser references
This commit is contained in:
parent
b30cdc90d6
commit
0ee0e120ca
@ -16,7 +16,7 @@ import {
|
||||
formatIso,
|
||||
formatExposureCompensation,
|
||||
formatExposureTime,
|
||||
} from '@/utility/exif';
|
||||
} from '@/utility/exif-format';
|
||||
import { parameterize } from '@/utility/string';
|
||||
import camelcaseKeys from 'camelcase-keys';
|
||||
import { isBefore } from 'date-fns';
|
||||
|
||||
27
src/utility/exif-format.ts
Normal file
27
src/utility/exif-format.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import { formatNumberToFraction, roundToString } from './number';
|
||||
|
||||
export const formatAperture = (aperture?: number) =>
|
||||
aperture
|
||||
? `ƒ/${roundToString(aperture)}`
|
||||
: undefined;
|
||||
|
||||
export const formatIso = (iso?: number) =>
|
||||
iso ? `ISO ${iso}` : undefined;
|
||||
|
||||
export const formatExposureTime = (exposureTime = 0) =>
|
||||
exposureTime > 0
|
||||
? exposureTime < 1
|
||||
? `1/${Math.floor(1 / exposureTime)}s`
|
||||
: `${exposureTime}s`
|
||||
: undefined;
|
||||
|
||||
export const formatExposureCompensation = (exposureCompensation?: number) => {
|
||||
if (
|
||||
exposureCompensation &&
|
||||
Math.abs(exposureCompensation) > 0.01
|
||||
) {
|
||||
return `${formatNumberToFraction(exposureCompensation)}ev`;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
@ -1,5 +1,4 @@
|
||||
import { OrientationTypes, type ExifData } from 'ts-exif-parser';
|
||||
import { formatNumberToFraction, roundToString } from './number';
|
||||
|
||||
const OFFSET_REGEX = /[+-]\d\d:\d\d/;
|
||||
|
||||
@ -61,32 +60,6 @@ export const convertApertureValueToFNumber = (
|
||||
}
|
||||
};
|
||||
|
||||
export const formatAperture = (aperture?: number) =>
|
||||
aperture
|
||||
? `ƒ/${roundToString(aperture)}`
|
||||
: undefined;
|
||||
|
||||
export const formatIso = (iso?: number) =>
|
||||
iso ? `ISO ${iso}` : undefined;
|
||||
|
||||
export const formatExposureTime = (exposureTime = 0) =>
|
||||
exposureTime > 0
|
||||
? exposureTime < 1
|
||||
? `1/${Math.floor(1 / exposureTime)}s`
|
||||
: `${exposureTime}s`
|
||||
: undefined;
|
||||
|
||||
export const formatExposureCompensation = (exposureCompensation?: number) => {
|
||||
if (
|
||||
exposureCompensation &&
|
||||
Math.abs(exposureCompensation) > 0.01
|
||||
) {
|
||||
return `${formatNumberToFraction(exposureCompensation)}ev`;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
const SOS = 0xffda;
|
||||
const APP1 = 0xffe1;
|
||||
const EXIF = 0x45786966;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user