[NSImage lockFocus];
NSImage *image = [[NSImage alloc] initWithData:[imageBg dataWithPDFInsideRect:CGRectMake(0, 0, 200, 200)]];
[NSImage unlockFocus];
[image lockFocus];
NSBitmapImageRep *bits = [[NSBitmapImageRep alloc]initWithFocusedViewRect:CGRectMake(0, 0, 200, 200)];
[image unlockFocus];
NSDictionary *imageProps = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:0] forKey:NSImageCompressionFactor];
NSString *downloadimagepath = [[EVUtils get_current_app_path]stringByAppendingPathComponent:@"header.jpg"];
NSData *imageData = [bits representationUsingType:NSPNGFileType properties:imageProps];
[imageData writeToFile:[[[NSString alloc] initWithFormat:@"%@", downloadimagepath] stringByExpandingTildeInPath]atomically:YES];