Skip to content

Commit

Permalink
Merge pull request #335 from JunAishima/fix-ispyb-snapshot-resize
Browse files Browse the repository at this point in the history
Fix ispyb snapshot resize
  • Loading branch information
JunAishima authored Oct 16, 2023
2 parents 3f07c6c + d482745 commit 4116872
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ispybLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import db_lib
import det_lib
import time
from PIL import Image
import logging
logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -228,10 +229,13 @@ def insertResult(result,resultType,request,visitName,dc_id=None,xmlFileName=None
daq_utils.take_crystal_picture(filename=jpegImagePrefix)
jpegImageFilename = jpegImagePrefix+".jpg"
jpegImageThumbFilename = jpegImagePrefix+"t.jpg"
node = db_lib.getBeamlineConfigParam(beamline,"adxvNode")
comm_s = f"ssh -q {node} \"{os.environ['MXPROCESSINGSCRIPTSDIR']}resize.sh {jpegImageFilename} {jpegImageThumbFilename} 40% \"&"
logger.info('resizing image: %s' % comm_s)
os.system(comm_s)
resizeRatio = 0.4
logger.info(f'resizing image: ratio: {resizeRatio} filename: {jpegImageThumbFilename}')
fullSnapshot = Image.open(jpegImageFilename)
resizeWidth = fullSnapshot.width * resizeRatio
resizeHeight = fullSnapshot.height * resizeRatio
thumbSnapshot = fullSnapshot.resize((int(resizeWidth), int(resizeHeight)))
thumbSnapshot.save(jpegImageThumbFilename)

seqNum = int(det_lib.detector_get_seqnum())
node = db_lib.getBeamlineConfigParam(beamline,"adxvNode")
Expand Down

0 comments on commit 4116872

Please sign in to comment.