Skip to content

Add object detection, tracking, mobile notifications, and search to any security camera.

use jpg

roryclear8c4a29265b91
diff --git a/clearcam/FileServer.m b/clearcam/FileServer.m
index 0c74e65..a76a38c 100644
--- a/clearcam/FileServer.m
+++ b/clearcam/FileServer.m
@@ -732,9 +732,9 @@
dprintf(clientSocket, "Content-Length: %lu\r\n", fileSize);
dprintf(clientSocket, "\r\n");
[self sendFileData:file toSocket:clientSocket withContentLength:fileSize];
- } else if ([fileExtension isEqualToString:@"png"]) {
+ } else if ([fileExtension isEqualToString:@"jpg"]) {
dprintf(clientSocket, "HTTP/1.1 200 OK\r\n");
- dprintf(clientSocket, "Content-Type: image/png\r\n");
+ dprintf(clientSocket, "Content-Type: image/jpg\r\n");
dprintf(clientSocket, "Content-Length: %lu\r\n", fileSize);
dprintf(clientSocket, "\r\n");
[self sendFileData:file toSocket:clientSocket withContentLength:fileSize];
@@ -918,7 +918,7 @@
@"timeStamp": readableDate, // Readable date format
@"classType": [event valueForKey:@"classType"] ?: @"unknown",
@"quantity": [event valueForKey:@"quantity"] ?: @(0),
- @"imageURL": [NSString stringWithFormat:@"images/%f.png", timestamp]
+ @"imageURL": [NSString stringWithFormat:@"images/%f.jpg", timestamp]
};
[eventDataArray addObject:eventDict];
}
diff --git a/clearcam/SceneState.m b/clearcam/SceneState.m
index e41dd5e..1242c74 100644
--- a/clearcam/SceneState.m
+++ b/clearcam/SceneState.m
@@ -74,11 +74,11 @@
}
// File path for the image
- NSString *filePath = [imagesDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%f.png", unixTimestamp]];
-
- // Convert UIImage to PNG data
- NSData *imageData = UIImagePNGRepresentation(uiImage);
-
+ NSString *filePath = [imagesDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%f.jpg", unixTimestamp]]; // Changed file extension to .jpg
+
+ // Convert UIImage to JPEG data
+ NSData *imageData = UIImageJPEGRepresentation(uiImage, 1.0); // 1.0 for maximum quality
+
// Write the image data to file
if (![imageData writeToFile:filePath atomically:YES]) {
NSLog(@"Failed to save image at path: %@", filePath);